mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
abbrv. names now accepted when parsing logbooks, survex
This commit is contained in:
parent
55bc042798
commit
e9790e70d6
@ -146,6 +146,8 @@ def GetPersonExpeditionNameLookup(expedition):
|
|||||||
|
|
||||||
#print("Calculating GetPersonExpeditionNameLookup for " + expedition.year)
|
#print("Calculating GetPersonExpeditionNameLookup for " + expedition.year)
|
||||||
personexpeditions = PersonExpedition.objects.filter(expedition=expedition)
|
personexpeditions = PersonExpedition.objects.filter(expedition=expedition)
|
||||||
|
short = {}
|
||||||
|
dellist = []
|
||||||
for personexpedition in personexpeditions:
|
for personexpedition in personexpeditions:
|
||||||
possnames = [ ]
|
possnames = [ ]
|
||||||
f = unidecode(unescape(personexpedition.person.first_name.lower()))
|
f = unidecode(unescape(personexpedition.person.first_name.lower()))
|
||||||
@ -158,6 +160,12 @@ def GetPersonExpeditionNameLookup(expedition):
|
|||||||
possnames.append(f[0] + " " + l)
|
possnames.append(f[0] + " " + l)
|
||||||
possnames.append(f[0] + l[0]) # initials e.g. gb or bl
|
possnames.append(f[0] + l[0]) # initials e.g. gb or bl
|
||||||
possnames.append(f)
|
possnames.append(f)
|
||||||
|
|
||||||
|
lim = min(4, len(f)+1) # short form, e.g. Dan for Daniel. May be duplicate, e.g. several Dave
|
||||||
|
if f[:lim] not in short:
|
||||||
|
short[f[:lim]]= personexpedition
|
||||||
|
else:
|
||||||
|
dellist.append(f[:lim])
|
||||||
if full not in possnames:
|
if full not in possnames:
|
||||||
possnames.append(full)
|
possnames.append(full)
|
||||||
if personexpedition.nickname not in possnames:
|
if personexpedition.nickname not in possnames:
|
||||||
@ -180,6 +188,12 @@ def GetPersonExpeditionNameLookup(expedition):
|
|||||||
|
|
||||||
for possname in duplicates:
|
for possname in duplicates:
|
||||||
del res[possname]
|
del res[possname]
|
||||||
|
|
||||||
|
for possname in dellist:
|
||||||
|
if possname in short: #always true ?
|
||||||
|
del short[possname]
|
||||||
|
for shortname in short:
|
||||||
|
res[shortname] = short[shortname]
|
||||||
|
|
||||||
Gpersonexpeditionnamelookup[expedition.name] = res
|
Gpersonexpeditionnamelookup[expedition.name] = res
|
||||||
return res
|
return res
|
||||||
|
@ -126,7 +126,7 @@ class LoadingSurvex():
|
|||||||
rx_teammem = re.compile(r"(?i)"+instruments+"?(?:es|s)?\s+(.*)$")
|
rx_teammem = re.compile(r"(?i)"+instruments+"?(?:es|s)?\s+(.*)$")
|
||||||
rx_teamold = re.compile(r"(?i)(.*)\s+"+instruments+"?(?:es|s)?$")
|
rx_teamold = re.compile(r"(?i)(.*)\s+"+instruments+"?(?:es|s)?$")
|
||||||
rx_teamabs = re.compile(r"(?i)^\s*("+instruments+")?(?:es|s)?\s*$")
|
rx_teamabs = re.compile(r"(?i)^\s*("+instruments+")?(?:es|s)?\s*$")
|
||||||
rx_person = re.compile(r"(?i) and | / |, | & | \+ |^both$|^none$")
|
rx_person = re.compile(r"(?i) and |/| / |, | & | \+ |^both$|^none$")
|
||||||
rx_qm = re.compile(r'(?i)^\s*QM(\d+)\s+?([a-dA-DxX])\s+([\w\-\_]+)\.([\w\.\-]+)\s+(([\w\-]+)\.([\w\.\-]+)|\-)\s+(.+)$')
|
rx_qm = re.compile(r'(?i)^\s*QM(\d+)\s+?([a-dA-DxX])\s+([\w\-\_]+)\.([\w\.\-]+)\s+(([\w\-]+)\.([\w\.\-]+)|\-)\s+(.+)$')
|
||||||
# does not recognise non numeric suffix survey point ids
|
# does not recognise non numeric suffix survey point ids
|
||||||
rx_qm0 = re.compile(r'(?i)^\s*QM(\d+)\s+(.+)$')
|
rx_qm0 = re.compile(r'(?i)^\s*QM(\d+)\s+(.+)$')
|
||||||
@ -374,11 +374,11 @@ class LoadingSurvex():
|
|||||||
# print(self.insp+message)
|
# print(self.insp+message)
|
||||||
# DataIssue.objects.create(parser='survex', message=message)
|
# DataIssue.objects.create(parser='survex', message=message)
|
||||||
pr.personexpedition = pe
|
pr.personexpedition = pe
|
||||||
pr.person = p.personexpedition.person
|
pr.person = pr.personexpedition.person
|
||||||
pr.save()
|
pr.save()
|
||||||
self.currentpersonexped.append(pe) # used in push/pop block code
|
self.currentpersonexped.append(pe) # used in push/pop block code
|
||||||
else:
|
else:
|
||||||
message = "! *team {} '{}' FAIL personexpedition lookup on *date {} ({}) '{}'".format(year, p, survexblock.survexfile.path, survexblock, p.personname)
|
message = "! *team {} '{}' FAIL personexpedition lookup on *date {} ({}) '{}'".format(year, pr, survexblock.survexfile.path, survexblock, pr.personname)
|
||||||
print(self.insp+message)
|
print(self.insp+message)
|
||||||
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
DataIssue.objects.create(parser='survex', message=message, url=get_offending_filename(survexblock.survexfile.path))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user