File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,10 +252,20 @@ def insert_to_databaseREDESIGN(data):
252252 if not doc .group and wg :
253253 changed_attributes ["group" ] = Group .objects .get (acronym = wg )
254254
255- pubdate = datetime .strptime (rfc_published_date , "%Y-%m-%d" )
256- if not doc .latest_event (type = "published_rfc" , time = pubdate ):
255+ if not doc .latest_event (type = "published_rfc" ):
257256 e = DocEvent (doc = doc , type = "published_rfc" )
258- e .time = pubdate
257+ pubdate = datetime .strptime (rfc_published_date , "%Y-%m-%d" )
258+ # unfortunately, pubdate doesn't include the correct day
259+ # at the moment because the data only has month/year, so
260+ # try to deduce it
261+ synthesized = datetime .now ()
262+ if abs (pubdate - synthesized ) > timedelta (days = 60 ):
263+ synthesized = pubdate
264+ else :
265+ direction = - 1 if (pubdate - synthesized ).total_seconds () < 0 else + 1
266+ while synthesized .month != pubdate .month or synthesized .year != pubdate .year :
267+ synthesized += timedelta (days = direction )
268+ e .time = synthesized
259269 e .by = system
260270 e .desc = "RFC published"
261271 e .save ()
You can’t perform that action at this time.
0 commit comments