summaryrefslogtreecommitdiffstats
path: root/core/models
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-08-31 09:27:14 +0300
committerPhilip Sargent <philip.sargent@klebos.com>2022-08-31 09:27:14 +0300
commitdc2b8ad4310af2a2fe842a991ff8dfdda0099a3f (patch)
tree57ecd3843260844438ea0252bfcaaf7420d31d60 /core/models
parent3af1112847a9573ee4c318e1a997e579fd29ee45 (diff)
downloadtroggle-dc2b8ad4310af2a2fe842a991ff8dfdda0099a3f.tar.gz
troggle-dc2b8ad4310af2a2fe842a991ff8dfdda0099a3f.tar.bz2
troggle-dc2b8ad4310af2a2fe842a991ff8dfdda0099a3f.zip
fixes for crashes,svx files in wallets
Diffstat (limited to 'core/models')
-rw-r--r--core/models/survex.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/core/models/survex.py b/core/models/survex.py
index d165d14..fe39136 100644
--- a/core/models/survex.py
+++ b/core/models/survex.py
@@ -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"]: