summaryrefslogtreecommitdiffstats
path: root/core/views/scans.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/views/scans.py')
-rw-r--r--core/views/scans.py30
1 files changed, 12 insertions, 18 deletions
diff --git a/core/views/scans.py b/core/views/scans.py
index c7295a9..4d9f851 100644
--- a/core/views/scans.py
+++ b/core/views/scans.py
@@ -52,20 +52,15 @@ def populatewallet(w):
def caveifywallet(w):
- """Gets the cave from the list of survex files,
- only selects one of them though. Only used for display.
- FIX THIS to display many caves
- """
+ """Gets the caves from the list of survex files,
+ """
# print(f' - Caveify {w=}')
blocknames = []
blocks = SurvexBlock.objects.filter(scanswallet=w)
for b in blocks:
# NB b.cave is not populated by parser. Use b.survexfile.cave instead, or we could parse b.survexpath
if b.survexfile.cave:
- w.caveobj = (
- b.survexfile.cave
- ) # just gets the last one, randomly. SHould make this a list or many:many ideally
- w.cave = w.caveobj
+ w.caves.add(b.survexfile.cave)
if b.name:
blocknames.append(b.name)
@@ -120,11 +115,10 @@ def is_cave(wallet, id):
if not id:
return False
Gcavelookup = GetCaveLookup()
- id = id.strip("' []'")
if id in Gcavelookup:
return True
else:
- # Historic wallets used just 2 or 3 digits and were all 1623 area. So, just for these wallets,
+ # Historic wallets were all 1623 area. So, just for wallets,
# assume it is 1623-xxx
if f"1623-{id}" in Gcavelookup:
print(f" - Should modify wallet {wallet} to use 1623- prefix for cave <{id}>")
@@ -145,26 +139,26 @@ def fillblankothers(w):
Gcavelookup = GetCaveLookup()
+ caveifywallet(w)
+
wcaveid = w.cave()
if not wcaveid or wcaveid == "":
- caveifywallet(w)
- else:
if type(wcaveid) == list:
for i in wcaveid:
- i = i.strip("' []'")
+ i = i.strip("' []\"")
if is_cave(w,i):
- w.caveobj = Gcavelookup[i] # just sets it to the last one found. nasty. bug waiting to happen
+ w.caves.add(Gcavelookup[i])
elif wcaveid.find(',') != -1:
# it's a list of cave ids as a string
ids = wcaveid.split(',')
for i in ids:
- i = i.strip("' []'")
+ i = i.strip("' []\"")
if is_cave(w,i):
- w.caveobj = Gcavelookup[i] # just sets it to the last one found. nasty. bug waiting to happen
+ w.caves.add(Gcavelookup[i])
else:
if is_cave(w,wcaveid):
- w.caveobj = Gcavelookup[wcaveid.strip("' []'")]
-
+ w.caves.add(Gcavelookup[i])
+
def fixsurvextick(w, ticks):
ticks["S"] = w.fixsurvextick(ticks["S"])