From f51d1e114e57d652025d5e0630c22dbc85eb4707 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Fri, 7 Oct 2022 23:47:05 +0300 Subject: [PATCH] small chnages to name resolution --- core/views/scans.py | 2 +- parsers/logbooks.py | 2 ++ parsers/people.py | 10 ++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/views/scans.py b/core/views/scans.py index aa6181a..79d6ccc 100644 --- a/core/views/scans.py +++ b/core/views/scans.py @@ -145,7 +145,7 @@ def walletslistperson(request, first_name, last_name): if last_name: p = Person.objects.get(fullname= f'{first_name} {last_name}') else: - # speciall Wookey-hack + # special Wookey-hack p = Person.objects.get(first_name= f'{first_name}') except: #raise diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 8fc78d6..c704182 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -100,6 +100,8 @@ def GetTripPersons(trippeople, expedition, logtime_underground, tid=None): tripperson = "Phil Wigglesworth" if tripperson =="Animal": tripperson = "Mike Richardson" + if tripperson =="MikeTA": + tripperson = "Mike Richardson" personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower()) diff --git a/parsers/people.py b/parsers/people.py index 2de8e02..6ae9c2b 100644 --- a/parsers/people.py +++ b/parsers/people.py @@ -129,6 +129,11 @@ def load_people_expos(): # used in other referencing parser functions # expedition name lookup cached for speed (it's a very big list) +# should have a LIST of nicknames, just populate the first entry from folk.csv + +# Refactor. The dict GetPersonExpeditionNameLookup(expo) indexes by name and has values of personexpedition +# This is convoluted, the whole personexpedition concept is unnecessary. + Gpersonexpeditionnamelookup = { } def GetPersonExpeditionNameLookup(expedition): global Gpersonexpeditionnamelookup @@ -151,14 +156,15 @@ def GetPersonExpeditionNameLookup(expedition): possnames.append(f + " " + l[0]) possnames.append(f + l[0]) possnames.append(f[0] + " " + l) + possnames.append(f[0] + l[0]) # initials e.g. gb or bl possnames.append(f) if full not in possnames: possnames.append(full) if personexpedition.nickname not in possnames: possnames.append(personexpedition.nickname.lower()) if l: - # This allows for nickname to be used for short name eg Phil - # adding Phil Sargent to the list + # This allows for nickname to be used for short name + # eg Phil S is adding Phil Sargent to the list if str(personexpedition.nickname.lower() + " " + l) not in possnames: possnames.append(personexpedition.nickname.lower() + " " + l) if str(personexpedition.nickname.lower() + " " + l[0]) not in possnames: