From 79672dd4b37754d9579ba3ef70f172560fa6eba6 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 25 Aug 2022 16:12:13 +0300 Subject: [PATCH] bugfix --- parsers/logbooks.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 2f57dcf..7995d8b 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -317,9 +317,10 @@ def Parseloghtmltxt(year, expedition, txt): \s*(?:\s*(.*?))? \s*$ ''', trippara) - tripid, tripid1, tripdate, trippeople, triptitle, triptext, tu = s.groups() - if not s: # allow title and people to be swapped in order - s = re.match(r'''(?x)(?:\s*.*?\s*

)? # second date + if s: + tripid, tripid1, tripdate, trippeople, triptitle, triptext, tu = s.groups() + else: # allow title and people to be swapped in order + s2 = re.match(r'''(?x)(?:\s*.*?\s*

)? # second date \s*(?:\s*)? \s*(.*?)(?:

)? \s*\s*(.*?) @@ -328,15 +329,15 @@ def Parseloghtmltxt(year, expedition, txt): \s*(?:\s*(.*?))? \s*$ ''', trippara) - tripid, tripid1, tripdate, triptitle, trippeople, triptext, tu = s.groups() - - if not s: - if not re.search(r"Rigging Guide", trippara): - msg = " !- Logbook. Can't parse: {} entry:{}".format(trippara, logbook_entry_count) - print(msg) - DataIssue.objects.create(parser='logbooks', message=msg) - logdataissues[tid]=msg - continue + if s2: + tripid, tripid1, tripdate, triptitle, trippeople, triptext, tu = s2.groups() + else: + if not re.search(r"Rigging Guide", trippara): + msg = " !- Logbook. Can't parse: {} entry:{}".format(trippara, logbook_entry_count) + print(msg) + DataIssue.objects.create(parser='logbooks', message=msg) + logdataissues[tid]=msg + continue ldate = ParseDate(tripdate.strip(), year) triptitles = triptitle.split(" - ")