2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

better detect unknown cave identifer strings from users

This commit is contained in:
Philip Sargent 2023-07-25 21:07:13 +03:00
parent 5ce21564fc
commit af552a3d62

View File

@ -233,14 +233,19 @@ def cavewallets(request, caveid):
for z in zilchwallets: for z in zilchwallets:
zcaveid = z.cave() zcaveid = z.cave()
if zcaveid: if zcaveid:
if str(zcaveid) in Gcavelookup: cleanid = str(zcaveid).strip("'[]'")
fcave = Gcavelookup[str(zcaveid)] if cleanid in Gcavelookup:
fcave = Gcavelookup[cleanid]
if str(fcave.slug()) == caveid: if str(fcave.slug()) == caveid:
# print(f' - Found one ! {z.walletname=} {zcaveid=}') # print(f' - Found one ! {z.walletname=} {zcaveid=}')
wallets.add(z) wallets.add(z)
elif cleanid in ['surface', 'unknown', '']:
message = f" ! In {z.walletname} ignore '{cleanid}' "
print(message)
pass
else: else:
wurl = f"/walletedit/{z.walletname.replace('#',':')}" wurl = f"/walletedit/{z.walletname.replace('#',':')}"
message = f" ! In {z.walletname} there is an unrecognised cave name '{zcaveid}' (out of {len(Gcavelookup):,} cave names and aliases)" message = f" ! In {z.walletname} there is an unrecognised cave name '{cleanid}' (out of {len(Gcavelookup):,} cave names and aliases)"
print(message) print(message)
DataIssue.objects.update_or_create(parser="scans", message=message, url=wurl) DataIssue.objects.update_or_create(parser="scans", message=message, url=wurl)