summaryrefslogtreecommitdiffstats
path: root/core/views/scans.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-09-16 13:53:05 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-09-16 13:53:05 +0300
commit9db0b2a191b0ab8132cbae2ba526d75fddf48800 (patch)
tree38c983392425a090675a1a95a747cd06d5f17d75 /core/views/scans.py
parenta8d4b05617f4ef42687bc0354e2940226ab6987f (diff)
downloadtroggle-9db0b2a191b0ab8132cbae2ba526d75fddf48800.tar.gz
troggle-9db0b2a191b0ab8132cbae2ba526d75fddf48800.tar.bz2
troggle-9db0b2a191b0ab8132cbae2ba526d75fddf48800.zip
recognise old cave id codes in old wallets "1623-"
Diffstat (limited to 'core/views/scans.py')
-rw-r--r--core/views/scans.py29
1 files changed, 19 insertions, 10 deletions
diff --git a/core/views/scans.py b/core/views/scans.py
index b998b27..a0e0446 100644
--- a/core/views/scans.py
+++ b/core/views/scans.py
@@ -86,17 +86,26 @@ def fillblankpeople(w):
# print(f' - {wp=} {nobody=}')
populatewallet(w)
-def is_cave(id):
+def is_cave(wallet, id):
+ if not id:
+ return False
Gcavelookup = GetCaveLookup()
id = id.strip("' []'")
if id in Gcavelookup:
return True
else:
- print(f" - Failed to find cave object from id <{id}>")
- if id.lower() != "unknown" and id != "":
- print(f" - adding <{id}> to pendingcaves.txt list")
- add_cave_to_pending_list(id, f"Could not find id <{id}>")
- return False
+ # Historic wallets used just 2 or 3 digits and were all 1623 area. So, just for these wallets,
+ # assume it is 1623-xxx
+ if f"1623-{id}" in Gcavelookup:
+ print(f" - Should modify wallet {wallet} to us 1623- prefix for cave <{id}>")
+ Gcavelookup[id] = Gcavelookup[f"1623-{id}"] # restoring ambiguous alias
+ return True
+ else:
+ print(f" - Wallet {wallet} Failed to find cave object from id <{id}>")
+ if id.lower() != "unknown" and id != "":
+ print(f" - adding <{id}> to pendingcaves.txt list")
+ add_cave_to_pending_list(id, f"Wallet {wallet} - Could not find id <{id}>")
+ return False
def fillblankothers(w):
"""This is on the way to having a many:many relationship between Caves and Wallets
@@ -113,17 +122,17 @@ def fillblankothers(w):
if type(wcaveid) == list:
for i in wcaveid:
i = i.strip("' []'")
- if is_cave(i):
+ if is_cave(w,i):
w.caveobj = Gcavelookup[i] # just sets it to the last one found. nasty. bug waiting to happen
elif wcaveid.find(',') != -1:
# it's a list of cave ids as a string
ids = wcaveid.split(',')
for i in ids:
i = i.strip("' []'")
- if is_cave(i):
+ if is_cave(w,i):
w.caveobj = Gcavelookup[i] # just sets it to the last one found. nasty. bug waiting to happen
else:
- if is_cave(wcaveid):
+ if is_cave(w,wcaveid):
w.caveobj = Gcavelookup[wcaveid.strip("' []'")]
@@ -267,7 +276,7 @@ def cavewallets(request, caveid):
ids = cleanid.split(',')
for i in ids:
i = i.strip("' []'")
- if is_cave(i):
+ if is_cave(z,i):
fcave = Gcavelookup[i.strip("' []'")] # just sets it to the last one found. nasty. bug waiting to happen
elif cleanid in Gcavelookup: