forked from expo/troggle
more complete list of caves linked to wallets
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user