GetCave:Lookup neeeds work

This commit is contained in:
Philip Sargent 2022-07-24 21:38:14 +03:00
parent 5007393536
commit de7388bdc5

View File

@ -567,7 +567,9 @@ class PersonTrip(TroggleModel):
Gcavelookup = None
Gcave_count = None
def GetCaveLookup():
"""lookup function modelled on GetPersonExpeditionNameLookup
"""A very relaxed way of finding probably the right cave given almost any string which might serve to identify it
lookup function modelled on GetPersonExpeditionNameLookup
repeated assignment each call, needs refactoring
Used when parsing wallets contents.json file too in views/uploads.py
@ -590,7 +592,9 @@ def GetCaveLookup():
Gcave_count[key] += 1
if cave.kataster_number:
Gcavelookup[cave.kataster_number] = cave # DUPLICATE as we have 1623-55 and 1626-55
Gcavelookup[f'{cave.area}-{cave.kataster_number}'] = cave
Gcave_count[cave.kataster_number] += 1
Gcave_count[f'{cave.area}-{cave.kataster_number}'] += 1
if cave.unofficial_number:
Gcavelookup[cave.unofficial_number.lower()] = cave
Gcave_count[cave.unofficial_number.lower()] += 1
@ -733,6 +737,9 @@ def GetCaveLookup():
Gcavelookup["homecoming"] = Gcavelookup["2018-dm-07"]
Gcavelookup["heimkommen"] = Gcavelookup["2018-dm-07"]
Gcavelookup["99ob02"] = Gcavelookup["1999-ob-02"]
#Gcavelookup["1626-354"] = Gcavelookup["354"]
except:
raise