No more protocols without date
Check if a protocol has a date attached to it after parsing. If not, give it the current date. fixes #237 (closed)
Also fixes an issue in upload_new_protocol_by_file
.
Merge request reports
Activity
168 168 if protocol is None: 169 169 raise Exception("No protocol given. Aborting parsing.") 170 170 parse_protocol_async_inner(protocol) 171 if protocol.date is None : 172 initialdate = datetime.now().date() 173 protocol.date = initialdate 174 db.session.commit() 175 _make_error(protocol, "Parsing", "No initial date given, use current date instead.", initialdate) Es wird implizit zu YYYY-MM-DD konvertiert; man könnte auch strftime nutzen um die Konvertierung explizit zu sehen. Man kann die description bestimmt auch besser füllen, ich wollte dort zumindest das benutzte datum drin haben.
Edited by Magnus Giesbertchanged this line in version 3 of the diff
Arg der fix löst das Problem nicht komplett. Bis
parse_protocol_async
durch ist existiert ja immer noch temporär ein Protokoll ohne Datum.Es wäre wahrscheinlich klüger beim erstellen des Protokolls diesem schon ein Datum zu geben und ein leicht modifiziertes parsing zu machen was den Fehler, dass das Datum im System und im geparsten nicht übereinstimmen, ignoriert und das Datum was im geparsten steht übernimmt.
added 1 commit
- 3c5033be - Allow `fill_from_remarks` to ignore the old protocol date
added 1 commit
- 2c2eca3c - give `parse_protocol`, `parse_protocol_async` and `parse_protocol_async_inner`...
added 1 commit
- 8caa2226 - Have `upload_new_protocol` give protocols an initial date and then overwrite...
mentioned in commit 7d3e3ed5