summaryrefslogtreecommitdiffstats
path: root/parsers
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2024-07-23 11:34:12 +0200
committerPhilip Sargent <philip.sargent@gmail.com>2024-07-23 11:34:12 +0200
commit07fc372b4175e683631ba1905526d927a066f97e (patch)
tree9a7f07ca428c383ebea5f4c73c24110bced686ad /parsers
parentfeaf38aa39eb867b359fa5ceab6fe7d3886fc782 (diff)
downloadtroggle-07fc372b4175e683631ba1905526d927a066f97e.tar.gz
troggle-07fc372b4175e683631ba1905526d927a066f97e.tar.bz2
troggle-07fc372b4175e683631ba1905526d927a066f97e.zip
belt and braces prevent bad lbe ids
Diffstat (limited to 'parsers')
-rw-r--r--parsers/logbooks.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index 45cc00d..69a2850 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -59,8 +59,8 @@ LOGBOOK_PARSER_SETTINGS = {
LOGBOOKS_DIR = "years" # subfolder of settings.EXPOWEB
ENTRIES = {
- "2024": 27,
- "2023": 86,
+ "2024": 41,
+ "2023": 91,
"2022": 94,
"2019": 55,
"2018": 95,
@@ -299,6 +299,11 @@ def store_entry_into_database(date, place, tripcave, title, text, trippersons, a
def parser_date(tripdate, year):
"""Interprets dates in the expo logbooks and returns a correct datetime.date object
Does NOT actually check that it is a truly valid date..
+
+ tripdate : string
+ year : string
+
+ Nasty bug if it returns just the year which leads to a logbook id '/2023' instead of '/2023-07-16b'
"""
dummydate = EPOCH
month = 1
@@ -410,6 +415,13 @@ def parser_html(year, expedition, txt, seq=""):
continue
ldate = parser_date(tripdate.strip(), year)
+ if len(str(ldate)) < 10:
+ ldate = date(year, 10, 1) # 1st October
+ msg = f" !- Logbook. Bad parsed date '{tripdate}' setting to '{ldate}'"
+ print(msg)
+ DataIssue.objects.create(parser="logbooks", message=msg)
+ continue
+
# Now we have a date, we can reset tripid
tid = reset_trip_id(ldate)