summaryrefslogtreecommitdiffstats
path: root/parsers/logbooks.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-07-15 15:11:49 +0300
committerPhilip Sargent <philip.sargent@klebos.com>2022-07-15 15:11:49 +0300
commitb8355cbf8d38e86e162604f4b3416d38f503d7a8 (patch)
treea633463e3e21c4b06fd3d585f0380152368e6352 /parsers/logbooks.py
parent86a18c3ebccf737142abedfc3b3ba40296c6aecd (diff)
downloadtroggle-b8355cbf8d38e86e162604f4b3416d38f503d7a8.tar.gz
troggle-b8355cbf8d38e86e162604f4b3416d38f503d7a8.tar.bz2
troggle-b8355cbf8d38e86e162604f4b3416d38f503d7a8.zip
fix bugs and tidyup in recent changes
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r--parsers/logbooks.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index 47091cf..09da662 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -59,7 +59,7 @@ noncaveplaces = [ "QMplaceholder", "Journey", "Loser Plateau", "UNKNOWN", 'plate
logdataissues = TROG['issues']['logdataissues']
trips ={}
-entries = { "2019": 20, "2018": 74, "2017": 60, "2016": 81, "2015": 79,
+entries = { "2019": 36, "2018": 74, "2017": 60, "2016": 81, "2015": 79,
"2014": 65, "2013": 51, "2012": 75, "2011": 68, "2010": 22, "2009": 52,
"2008": 49, "2007": 111, "2006": 60, "2005": 55, "2004": 76, "2003": 40, "2002": 31,
"2001": 48, "2000": 54, "1999": 79, "1998": 43, "1997": 53, "1996": 94, "1995": 41,
@@ -174,6 +174,7 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_
def ParseDate(tripdate, year):
""" Interprets dates in the expo logbooks and returns a correct datetime.date object """
+ dummydate = date(1970, 1, 1)
try:
mdatestandard = re.match(r"(\d\d\d\d)-(\d\d)-(\d\d)", tripdate)
mdategoof = re.match(r"(\d\d?)/0?(\d)/(20|19)?(\d\d)", tripdate)
@@ -182,7 +183,7 @@ def ParseDate(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, 1, 1)
+ return dummydate
else:
year, month, day = int(mdatestandard.group(1)), int(mdatestandard.group(2)), int(mdatestandard.group(3))
elif mdategoof:
@@ -190,7 +191,7 @@ def ParseDate(tripdate, year):
message = " ! - Bad date mdategoof.group(3) in logbook: " + tripdate + " - " + mdategoof.group(3)
DataIssue.objects.create(parser='logbooks', message=message)
logdataissues["tripdate"]=message
- return datetime.date(1970, 1, 1)
+ return dummydate
else:
yadd = int(year[:2]) * 100
day, month, year = int(mdategoof.group(1)), int(mdategoof.group(2)), int(mdategoof.group(4)) + yadd