mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
*team parsing much improved. Copes with everything now.
This commit is contained in:
parent
52a035e4cf
commit
ff8eaa241e
@ -134,14 +134,31 @@ def who_is_this(year,possibleid):
|
||||
else:
|
||||
return None
|
||||
|
||||
def known_foreigner(id):
|
||||
'''If this someone from ARGE or a known Austrian? Name has to be exact, no soft matching
|
||||
'''
|
||||
friends = ["P. Jeutter", "K. Jäger", "S. Steinberger", "R. Seebacher",
|
||||
"Dominik Jauch", "Fritz Mammel", "Marcus Scheuerman",
|
||||
"Uli Schütz", "Wieland Scheuerle",
|
||||
"Kai Schwekend", "Regina Kaiser", "Thilo Müller","Wieland Scheuerle",
|
||||
"Florian Gruner", "Helmut Stopka-Ebeler", "Aiko", "Mark Morgan"]
|
||||
|
||||
if id in friends:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
# Refactor. The dict GetPersonExpeditionNameLookup(expo) indexes by name and has values of personexpedition
|
||||
# This is convoluted, the whole personexpedition concept is unnecessary.
|
||||
# This is convoluted, the whole personexpedition concept is unnecessary?
|
||||
|
||||
Gpersonexpeditionnamelookup = { }
|
||||
def GetPersonExpeditionNameLookup(expedition):
|
||||
global Gpersonexpeditionnamelookup
|
||||
|
||||
def apply_variations(f, l):
|
||||
'''Be generous in guessing possible matches. Any duplicates will be ruled as invalid.
|
||||
'''
|
||||
f = f.lower()
|
||||
l = l.lower()
|
||||
variations = []
|
||||
@ -151,8 +168,9 @@ def GetPersonExpeditionNameLookup(expedition):
|
||||
variations.append(f + " " + l)
|
||||
variations.append(f + " " + l[0])
|
||||
variations.append(f + l[0])
|
||||
variations.append(f + l[0] + '.')
|
||||
variations.append(f + " " +l[0] + '.')
|
||||
variations.append(f[0] + " " + l)
|
||||
variations.append(f[0] + ". " + l)
|
||||
variations.append(f[0] + l)
|
||||
variations.append(f[0] + l[0]) # initials e.g. gb or bl
|
||||
return variations
|
||||
@ -188,25 +206,36 @@ def GetPersonExpeditionNameLookup(expedition):
|
||||
|
||||
if f == "Robert".lower():
|
||||
possnames += apply_variations("Bob", l)
|
||||
if f == "Rob".lower():
|
||||
possnames += apply_variations("Robert", l)
|
||||
|
||||
if f == "Andrew".lower():
|
||||
possnames += apply_variations("Andy", l)
|
||||
if f == "Andy".lower():
|
||||
possnames += apply_variations("Andrew", l)
|
||||
if f == "Michael".lower():
|
||||
possnames += apply_variations("Mike", l)
|
||||
|
||||
if f == "David".lower():
|
||||
possnames += apply_variations("Dave", l)
|
||||
if f == "Dave".lower():
|
||||
possnames += apply_variations("David", l)
|
||||
|
||||
if f == "Peter".lower():
|
||||
possnames += apply_variations("Pete", l)
|
||||
if f == "Pete".lower():
|
||||
possnames += apply_variations("Peter", l)
|
||||
|
||||
if f == "Olly".lower():
|
||||
possnames += apply_variations("Oliver", l)
|
||||
if f == "Oliver".lower():
|
||||
possnames += apply_variations("Olly", l)
|
||||
|
||||
if f == "Ollie".lower():
|
||||
possnames += apply_variations("Oliver", l)
|
||||
if f == "Oliver".lower():
|
||||
possnames += apply_variations("Ollie", l)
|
||||
|
||||
if f == "Becka".lower():
|
||||
possnames += apply_variations("Rebecca", l)
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user