fix more logbook parsing

This commit is contained in:
Philip Sargent 2022-12-17 17:05:55 +00:00
parent 0a4471e039
commit 73b710d53f
3 changed files with 9 additions and 6 deletions

View File

@ -90,7 +90,7 @@ class Expedition(TroggleModel):
if len(expeditiondays) == 1:
return expeditiondays[0]
else:
message =f'! - more than one datum in an expeditionday: {date}'
message =f'! - More than one expeditionday for the same date: {date} .\n - This should never happen. \n - Restart mysql and run reset to clean database.'
DataIssue.objects.create(parser='expedition', message=message)
return expeditiondays[0]
res = ExpeditionDay(expedition=self, date=date)

View File

@ -53,6 +53,7 @@ data for old logbooks. New design needed, with a mechanism for flagging fixtures
MAX_LOGBOOK_ENTRY_TITLE_LENGTH = 200
BLOG_PARSER_SETTINGS = {
# "2017": ("ukcavingblog.html", "parser_blog"), # now folded in to logbooks.html
"2018": ("ukcavingblog.html", "parser_blog"),
"2019": ("ukcavingblog.html", "parser_blog"),
"2022": ("ukcavingblog.html", "parser_blog"),
}
@ -67,7 +68,7 @@ LOGBOOK_PARSER_SETTINGS = {
"2008": ("2008logbook.txt", "wiki_parser"),
"2007": ("logbook.html", "parser_html"),
"2006": ("logbook.html", "parser_html"),
# "2006": ("logbook/logbook_06.txt", "wiki_parser"),
# "2006": ("logbook/logbook_06.txt", "wiki_parser"), # converted to html
"2006": ("logbook.html", "parser_html"),
"2005": ("logbook.html", "parser_html"),
"2004": ("logbook.html", "parser_html"),
@ -140,10 +141,12 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None):
tripperson = "Mike Richardson"
if tripperson =="MikeTA":
tripperson = "Mike Richardson"
if tripperson =="cavingpig":
if tripperson =="CavingPig":
tripperson = "Elaine Oliver"
if tripperson =="nobrotson":
tripperson = "Rob Watson"
if tripperson =="Tinywoman":
tripperson = "Nadia"
personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower())
@ -528,7 +531,7 @@ def parser_blog(year, expedition, txt, sq=""):
if (len(tripheads) !=len(tripparas)):
print(f"{len(tripheads)} != {len(tripparas)}")
location = "Plateau"
location = "Plateau" # best guess, fix manually later
tu = 0
logbook_entry_count = 0
for i in range(0, len(tripparas)):
@ -572,7 +575,7 @@ def parser_blog(year, expedition, txt, sq=""):
# tripname must have the location then a hyphen at the beginning as it is ignored by export function
location = "Unknown"
tripname = f"Expo - UK Caving Blog{sq} post {logbook_entry_count}" # must be unique for a given date
tripcontent = trippara + f"\n\nBlog Author: {trippeople}"
tripcontent = f"\n\nBlog Author: {trippeople}" + trippara
entrytuple = (tripdate, location, tripname, tripcontent,
trippeople, expedition, tu, tid)

View File

@ -137,7 +137,7 @@ def who_is_this(year,possibleid):
global foreign_friends
foreign_friends = ["P. Jeutter", "K. Jäger", "S. Steinberger", "R. Seebacher",
"Dominik Jauch", "Fritz Mammel", "Marcus Scheuerman",
"Uli Schütz", "Wieland Scheuerle",
"Uli Schütz", "Wieland Scheuerle", "Arndt Karger",
"Kai Schwekend", "Regina Kaiser", "Thilo Müller","Wieland Scheuerle",
"Florian Gruner", "Helmut Stopka-Ebeler", "Aiko", "Mark Morgan", "Arndt Karger"]