2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

improve date parse eror messages

This commit is contained in:
Philip Sargent 2022-07-09 01:30:49 +03:00
parent a4b1c7b142
commit 8d31ab763d

View File

@ -179,7 +179,7 @@ def ParseDate(tripdate, year):
mdategoof = re.match(r"(\d\d?)/0?(\d)/(20|19)?(\d\d)", tripdate)
if mdatestandard:
if not (mdatestandard.group(1) == year):
message = " ! - Bad date (year) in logbook: " + tripdate + " - " + year
message = f" ! - Bad date (year) in logbook: {tripdate} - {year}"
DataIssue.objects.create(parser='logbooks', message=message)
logdataissues["tripdate"]=message
return datetime.date('1970', '01', '01')
@ -195,16 +195,16 @@ def ParseDate(tripdate, year):
yadd = int(year[:2]) * 100
day, month, year = int(mdategoof.group(1)), int(mdategoof.group(2)), int(mdategoof.group(4)) + yadd
else:
message = " ! - Bad date in logbook: " + tripdate + " - " + year
message = f" ! - Bad date in logbook: {tripdate} - {year}"
DataIssue.objects.create(parser='logbooks', message=message)
logdataissues["tripdate"]=message
return date(year, month, day)
except:
message = " ! - Failed to parse date in logbook: " + tripdate + " - " + year
message = f" ! - Failed to parse date in logbook: {tripdate} - {year}"
DataIssue.objects.create(parser='logbooks', message=message)
logdataissues["tripdate"]=message
return date(year, month, day)
return date('1970', '01', '01')
# (2006 - not any more), 2008 - 2009
def Parselogwikitxt(year, expedition, txt):