diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-10-10 15:40:21 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-10-10 15:40:21 +0300 |
commit | ff8eaa241e8f23e6c207568c76ce618c358a93eb (patch) | |
tree | 32da4120fc320a7096a46b403909f1343d1c62eb /parsers/survex.py | |
parent | 52a035e4cf53d16f1b0dc60d7232fb403208ce63 (diff) | |
download | troggle-ff8eaa241e8f23e6c207568c76ce618c358a93eb.tar.gz troggle-ff8eaa241e8f23e6c207568c76ce618c358a93eb.tar.bz2 troggle-ff8eaa241e8f23e6c207568c76ce618c358a93eb.zip |
*team parsing much improved. Copes with everything now.
Diffstat (limited to 'parsers/survex.py')
-rw-r--r-- | parsers/survex.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index 714ba67..8d6cb33 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -14,7 +14,7 @@ from django.utils.timezone import make_aware import troggle.settings as settings from troggle.core.models.caves import Cave, Entrance, QM, LogbookEntry from troggle.core.utils import get_process_memory, chaosmonkey -from troggle.parsers.people import GetPersonExpeditionNameLookup +from troggle.parsers.people import GetPersonExpeditionNameLookup, known_foreigner from troggle.parsers.logbooks import GetCaveLookup from troggle.core.models.troggle import DataIssue, Expedition from troggle.core.models.survex import SurvexPersonRole, Wallet, SurvexDirectory, SurvexFile, SurvexBlock, SurvexStation @@ -225,7 +225,7 @@ class LoadingSurvex(): (NB PersonTrip is a logbook thing) """ def record_team_member(tm, survexblock): - tm = tm.strip('\"\'') + tm = tm.strip('\"\'').strip() # Refactor. The dict GetPersonExpeditionNameLookup(expo) indexes by name and has values of personexpedition # This is convoluted, the whole personexpedition concept is unnecessary. @@ -251,6 +251,10 @@ class LoadingSurvex(): personrole.expeditionday = survexblock.expeditionday self.currentpersonexped.append(personexpedition) # used in push/pop block code personrole.save() + elif known_foreigner(tm): # note, not using .lower() + message = "- *team {} '{}' known foreigner on *team {} ({}) in '{}'".format(expo.year, tm, survexblock.survexfile.path, survexblock, line) + print(self.insp+message) + # DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path)) else: # we know the date and expo, but can't find the person message = "! *team {} '{}' FAIL personexpedition lookup on *team {} ({}) in '{}'".format(expo.year, tm, survexblock.survexfile.path, survexblock, line) @@ -377,6 +381,10 @@ class LoadingSurvex(): pr.person = pr.personexpedition.person pr.save() self.currentpersonexped.append(pe) # used in push/pop block code + elif known_foreigner(pr.personname): # note, not using .lower() + message = "- *team {} '{}' known foreigner on *date {} ({}) in '{}'".format(expo.year, pr.personname, survexblock.survexfile.path, survexblock, line) + print(self.insp+message) + # DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path)) else: message = "! *team {} '{}' FAIL personexpedition lookup on *date {} ({}) '{}'".format(year, pr.personname, survexblock.survexfile.path, survexblock, pr.personname) print(self.insp+message) |