2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 03:17:12 +00:00

Many many bugs fixed for >1 svx file on a wallet

This commit is contained in:
2023-02-03 22:19:51 +00:00
parent c1231ff451
commit 175e71facf
4 changed files with 100 additions and 82 deletions

View File

@@ -32,7 +32,8 @@ class Wallet(models.Model):
return urljoin(settings.URL_ROOT, reverse("singlewallet", kwargs={"path": re.sub("#", "%23", self.walletname)}))
def get_json(self):
"""Read the JSON file for the wallet and do stuff"""
"""Read the JSON file for the wallet and do stuff
Do it every time it is queried, to be sure the result is fresh"""
# jsonfile = Path(self.fpath, 'contents.json')
# Get from git repo instead
@@ -102,9 +103,8 @@ class Wallet(models.Model):
"""Reads all the JSON data just to get the JSON date."""
if self.walletdate:
return self.walletdate
if not self.get_json():
if not (jsondata := self.get_json()): # WALRUS
return None
jsondata = self.get_json() # use walrus operator?
datestr = jsondata["date"]
if not datestr:
@@ -259,7 +259,7 @@ class Wallet(models.Model):
ticks["N"] = "red"
else:
ticks["N"] = "green"
print(f"{self.walletname} {ticks['N'].upper()} {notes_scanned=} {notes_required=} {waldata['notes not required']=}")
# print(f"{self.walletname} {ticks['N'].upper()} {notes_scanned=} {notes_required=} {waldata['notes not required']=}")
# Plan drawing required
plan_scanned = reduce(operator.or_, [f.startswith("plan") for f in files], False)