diff options
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r-- | parsers/logbooks.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 51171d0..9d56894 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -35,7 +35,6 @@ def GetTripPersons(trippeople, expedition, logtime_underground): if mul: tripperson = mul.group(1).strip() if tripperson and tripperson[0] != '*': - #assert tripperson in personyearmap, "'%s' << %s\n\n %s" % (tripperson, trippeople, personyearmap) tripperson = re.sub(round_bracket_regex, "", tripperson).strip() personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower()) if not personyear: @@ -160,7 +159,6 @@ def Parselogwikitxt(year, expedition, txt): for triphead, triptext in trippara: logbook_entry_count += 1 tripheadp = triphead.split("|") - # assert len(tripheadp) == 3, (tripheadp, triptext) if not (len(tripheadp) == 3): message = " ! - Bad no of items in tripdate in logbook: " + tripdate + " - " + tripheadp DataIssue.objects.create(parser='logbooks', message=message) @@ -169,6 +167,12 @@ def Parselogwikitxt(year, expedition, txt): tripdate, tripplace, trippeople = tripheadp tripsplace = tripplace.split(" - ") tripcave = tripsplace[0].strip() + if len(tripsplace) == 1: + tripsplace = tripsplace[0] + else: + tripsplace = tripsplace[1] + + print(f"! LOGBOOK {year} {logbook_entry_count:2} {len(triptext):4} '{tripsplace}'") tul = re.findall(r"T/?U:?\s*(\d+(?:\.\d*)?|unknown)\s*(hrs|hours)?", triptext) if tul: @@ -193,7 +197,7 @@ def Parselogwikitxt(year, expedition, txt): def EnterLogIntoObjStore(year, date, tripcave, triptitle, text, trippeople, tu, formattype, tripid1, seq): # This will need additional functions to replicate the persontrip calculation and storage. For the # moment we leave all that to be done in the django db - global trips # should be a singleton class object in models.py eventually + global trips # should be a singleton TROG eventually global logdataissues if tripid1 is None or tripid1 =="": @@ -354,7 +358,6 @@ def Parseloghtml03(year, expedition, txt): logbook_entry_count += 1 s = re.match(r"(?s)\s*<p>(.*?)</p>(.*)$", trippara) - #assert s, trippara if not ( s ) : message = " ! - Skipping logentry on failure to parse Parseloghtml03: {} {} {}...".format(tripentry,s,trippara[:300]) DataIssue.objects.create(parser='logbooks', message=message) |