From de7388bdc54755c331c2549804b25cb848299537 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 24 Jul 2022 21:38:14 +0300 Subject: [PATCH] GetCave:Lookup neeeds work --- core/models/caves.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/models/caves.py b/core/models/caves.py index 3fae7f4..8d1f8ca 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -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