summaryrefslogtreecommitdiffstats
path: root/core/views/scans.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-09-22 01:37:25 +0300
committerPhilip Sargent <philip.sargent@klebos.com>2022-09-22 01:37:25 +0300
commitb4cf2bac95198fab404d3870c9829c016a65ac85 (patch)
tree4d82a215e5408834746c877e310d37b3b29295c5 /core/views/scans.py
parent5c0835e07630e7100dbbe07999a2afe0b27f1a0e (diff)
downloadtroggle-b4cf2bac95198fab404d3870c9829c016a65ac85.tar.gz
troggle-b4cf2bac95198fab404d3870c9829c016a65ac85.tar.bz2
troggle-b4cf2bac95198fab404d3870c9829c016a65ac85.zip
more complete list of caves linked to wallets
Diffstat (limited to 'core/views/scans.py')
-rw-r--r--core/views/scans.py32
1 files changed, 21 insertions, 11 deletions
diff --git a/core/views/scans.py b/core/views/scans.py
index 4e256a6..1b9ab95 100644
--- a/core/views/scans.py
+++ b/core/views/scans.py
@@ -64,13 +64,14 @@ def caveifywallet(w):
'''Gets the cave from the list of survex files,
only selects one of them though. Only used for display.
'''
+ 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.cave = b.survexfile.cave # just gets the last one, randomly. SHould make this a list or many:many ideally
-
+ w.caveobj = b.survexfile.cave # just gets the last one, randomly. SHould make this a list or many:many ideally
+ w.cave = w.caveobj
if b.name:
blocknames.append(b.name)
@@ -98,9 +99,18 @@ def fillblankothers(w):
if not w.date():
datewallet(w, earliest)
- c = w.cave()
- if not c or c == "":
+ Gcavelookup = GetCaveLookup()
+
+ wcaveid = w.cave()
+ if not wcaveid or wcaveid == "":
caveifywallet(w)
+ else:
+ if wcaveid in Gcavelookup:
+ w.caveobj = Gcavelookup[wcaveid]
+ # print(f' - Found cave object from id {wcaveid}')
+ else:
+ print(f' - Failed to find cave object from id {wcaveid}')
+
def fixsurvextick(w, ticks):
ticks["S"] = w.fixsurvextick(ticks["S"])
@@ -189,17 +199,17 @@ def cavewallets(request, caveid):
# all the ones without a survexblock attached via a *ref, search for match in JSON
zilchwallets = set(Wallet.objects.exclude(survexblock__survexfile__cave=cave))
for z in zilchwallets:
- zcave = z.cave()
- if zcave:
- if str(zcave) in Gcavelookup:
- fcave = Gcavelookup[str(zcave)]
+ zcaveid = z.cave()
+ if zcaveid:
+ if str(zcaveid) in Gcavelookup:
+ fcave = Gcavelookup[str(zcaveid)]
if str(fcave.slug()) == caveid:
- # print(f' - Found one ! {z.walletname=} {zcave=}')
+ # print(f' - Found one ! {z.walletname=} {zcaveid=}')
wallets.add(z)
else:
wurl = f"/scanupload/{z.walletname.replace('#',':')}"
- print(f' - Unrecognised cave name \'{zcave}\' in {z.walletname}')
- message = f" ! In {z.walletname} there is an unrecognised cave name '{zcave}'"
+ print(f' - Unrecognised cave name \'{zcaveid}\' in {z.walletname}')
+ message = f" ! In {z.walletname} there is an unrecognised cave name '{zcaveid}'"
DataIssue.objects.update_or_create(parser='scans', message=message, url=wurl)
manywallets = list(set(wallets))