2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 23:01:52 +00:00

fixing bad ids on newly entrered LBEs

This commit is contained in:
Philip Sargent 2024-07-26 14:31:54 +02:00
parent 9166b6ed74
commit 526d0ad904

View File

@ -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)