diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2024-07-26 14:31:54 +0200 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2024-07-26 14:31:54 +0200 |
commit | 526d0ad90435f8701069dff3dd7b07002feead15 (patch) | |
tree | 5a0e10f475ae470c75681ba49dfd9a4e55f65327 /parsers/logbooks.py | |
parent | 9166b6ed74808d733314c1f7f021805894bc90f9 (diff) | |
download | troggle-526d0ad90435f8701069dff3dd7b07002feead15.tar.gz troggle-526d0ad90435f8701069dff3dd7b07002feead15.tar.bz2 troggle-526d0ad90435f8701069dff3dd7b07002feead15.zip |
fixing bad ids on newly entrered LBEs
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r-- | parsers/logbooks.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 63533f3..54f4f56 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -252,8 +252,12 @@ def tidy_trip_image_urls(text, date): # print(f"tidy_trip_image_urls() - {y}\n {line}") return text -def tidy_tid(tid, title): - +def tidy_tid(tid, title, date): + if not tid.startswith(date): + message = f" ! - Logentry id does not have the same date {date=} {tid=} " + DataIssue.objects.create(parser="logbooks", message=message) + print(message) + if tid is not None: return tid @@ -421,7 +425,7 @@ def parser_html(year, expedition, txt, seq=""): print(msg) DataIssue.objects.create(parser="logbooks", message=msg) continue - + lgdate = f"{ldate}"[:10] # Now we have a date, we can reset tripid tid = reset_trip_id(ldate) @@ -448,7 +452,7 @@ def parser_html(year, expedition, txt, seq=""): trippersons, author, guests = tidy_trip_persons(trippeople, triptitle, expedition, tu, tid) tripcave = tidy_trip_cave(place) tripcontent = tidy_trip_image_urls(tripcontent, ldate) - tid = tidy_tid(tid, triptitle) + tid = tidy_tid(tid, triptitle, lgdate) entrytuple = (ldate, place, tripcave, triptitle, tripcontent, trippersons, author, guests, expedition, tu, tid) logentries.append(entrytuple) @@ -555,7 +559,7 @@ def parser_blog(year, expedition, txt, sq=""): # print(f" - author: {author}") tripcave = tidy_trip_cave(place) tripcontent = tidy_trip_image_urls(tripcontent, year) - tid = tidy_tid(tid, triptitle) + tid = tidy_tid(tid, triptitle, datestamp) entrytuple = (tripdate, place, tripcave, triptitle, tripcontent, trippersons, author, guests, expedition, tu, tid) logentries.append(entrytuple) |