forked from expo/troggle
*team parsing much improved. Copes with everything now.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user