2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-14 00:27:07 +00:00

fixes for crashes,svx files in wallets

This commit is contained in:
Philip Sargent
2022-08-31 09:27:14 +03:00
parent 3af1112847
commit dc2b8ad431
3 changed files with 117 additions and 52 deletions

View File

@@ -281,19 +281,24 @@ class Wallet(models.Model):
waldata["survex file"] = [waldata["survex file"]]
ngood = 0
nbad = 0
ticks["S"] = "black"
for svx in waldata["survex file"]:
if svx !="":
if (Path(settings.SURVEX_DATA) / svx).is_file():
ticks["S"] = "purple"
for sx in waldata["survex file"]:
#this logic appears in several places, inc uploads.py). Refactor.
if sx !="":
if Path(sx).suffix.lower() != ".svx":
sx = sx + ".svx"
if (Path(settings.SURVEX_DATA) / sx).is_file():
ngood += 1
else:
nbad += 1
if nbad == 0 and ngood >= 1:
ticks["S"] = "green"
if nbad >= 1 and ngood >= 1:
elif nbad >= 1 and ngood >= 1:
ticks["S"] = "orange"
if nbad >= 1 and ngood == 0:
elif nbad >= 1 and ngood == 0:
ticks["S"] = "red"
else:
ticks["S"] = "black"
# Cave Description
if waldata["description written"]: