forked from expo/troggle
improve date parse eror messages
This commit is contained in:
parent
a4b1c7b142
commit
8d31ab763d
@ -179,7 +179,7 @@ def ParseDate(tripdate, year):
|
|||||||
mdategoof = re.match(r"(\d\d?)/0?(\d)/(20|19)?(\d\d)", tripdate)
|
mdategoof = re.match(r"(\d\d?)/0?(\d)/(20|19)?(\d\d)", tripdate)
|
||||||
if mdatestandard:
|
if mdatestandard:
|
||||||
if not (mdatestandard.group(1) == year):
|
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)
|
DataIssue.objects.create(parser='logbooks', message=message)
|
||||||
logdataissues["tripdate"]=message
|
logdataissues["tripdate"]=message
|
||||||
return datetime.date('1970', '01', '01')
|
return datetime.date('1970', '01', '01')
|
||||||
@ -195,16 +195,16 @@ def ParseDate(tripdate, year):
|
|||||||
yadd = int(year[:2]) * 100
|
yadd = int(year[:2]) * 100
|
||||||
day, month, year = int(mdategoof.group(1)), int(mdategoof.group(2)), int(mdategoof.group(4)) + yadd
|
day, month, year = int(mdategoof.group(1)), int(mdategoof.group(2)), int(mdategoof.group(4)) + yadd
|
||||||
else:
|
else:
|
||||||
message = " ! - Bad date in logbook: " + tripdate + " - " + year
|
message = f" ! - Bad date in logbook: {tripdate} - {year}"
|
||||||
DataIssue.objects.create(parser='logbooks', message=message)
|
DataIssue.objects.create(parser='logbooks', message=message)
|
||||||
logdataissues["tripdate"]=message
|
logdataissues["tripdate"]=message
|
||||||
|
|
||||||
return date(year, month, day)
|
return date(year, month, day)
|
||||||
except:
|
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)
|
DataIssue.objects.create(parser='logbooks', message=message)
|
||||||
logdataissues["tripdate"]=message
|
logdataissues["tripdate"]=message
|
||||||
return date(year, month, day)
|
return date('1970', '01', '01')
|
||||||
|
|
||||||
# (2006 - not any more), 2008 - 2009
|
# (2006 - not any more), 2008 - 2009
|
||||||
def Parselogwikitxt(year, expedition, txt):
|
def Parselogwikitxt(year, expedition, txt):
|
||||||
|
Loading…
Reference in New Issue
Block a user