diff --git a/core/models/survex.py b/core/models/survex.py index 6977cb7..1071537 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -225,6 +225,8 @@ class Wallet(models.Model): return waldata def year(self): + if len(self.walletname) < 5: + return None if self.walletname[4] != "#": return None year = int(self.walletname[0:4]) @@ -352,8 +354,11 @@ class Wallet(models.Model): ticks["Q"] = "green" else: ticks["Q"] = survexok - if int(self.year()) < 2015: - ticks["Q"] = "lightgrey" + if not self.year(): + ticks["Q"] = "darkgrey" + else: + if int(self.year()) < 2015: + ticks["Q"] = "lightgrey" # Notes, Plan, Elevation; Tunnel diff --git a/core/views/uploads.py b/core/views/uploads.py index 3773e4f..17b57cb 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -359,7 +359,7 @@ def scanupload(request, path=None): year = wallet[:4] try: - if int(year) <= 1998: + if wallet[4]!= "#": #print(f'! - FORM scanupload - start {wallet} REDIRECT TO OLDWALLET') return(oldwallet(request, path)) except: diff --git a/parsers/scans.py b/parsers/scans.py index 60b3d17..109d231 100644 --- a/parsers/scans.py +++ b/parsers/scans.py @@ -100,25 +100,32 @@ def load_all_scans(): for walletname, fpath, fisdir in GetListDir(settings.SCANS_ROOT): if not fisdir: continue - - # do the year folders - if re.match(r"\d\d\d\d$", walletname): - print(f"{walletname}", end=' ') - for walletname, fpath, fisdir in GetListDir(fpath): - if fisdir: - wallet = Wallet(fpath=fpath, walletname=walletname) - # this is where we should load the contents.json for people, cave and date so we can report on them later - # this is where we should record the year explicitly - # line 347 of view/uploads.py and needs refactoring for loading contentsjson - CheckEmptyDate(wallet) - CheckEmptyPeople(wallet) - wallet.save() - LoadListScansFile(wallet) - - - else: - # but We *should* load all the scans, even for nonstandard names. - print(f'\n - IGNORE {walletname} - {fpath}') + + for walletname, fpath, fisdir in GetListDir(fpath): + if fisdir: + wallet = Wallet(fpath=fpath, walletname=walletname) + # this is where we should record the year explicitly + # line 347 of view/uploads.py and needs refactoring for loading contentsjson + CheckEmptyDate(wallet) + CheckEmptyPeople(wallet) + wallet.save() + LoadListScansFile(wallet) + + # # do the year folders + # if re.match(r"\d\d\d\d$", walletname): + # print(f"{walletname}", end=' ') + # for walletname, fpath, fisdir in GetListDir(fpath): + # if fisdir: + # wallet = Wallet(fpath=fpath, walletname=walletname) + # # this is where we should record the year explicitly + # # line 347 of view/uploads.py and needs refactoring for loading contentsjson + # CheckEmptyDate(wallet) + # CheckEmptyPeople(wallet) + # wallet.save() + # LoadListScansFile(wallet) + # else: + # # but We *should* load all the scans, even for nonstandard names. + # print(f'\n - IGNORE {walletname} - {fpath}') # but we also need to check if JSON exists, even if there are no uploaded scan files contents_path = Path(settings.DRAWINGS_DATA, "walletjson") diff --git a/templates/wallet_table.html b/templates/wallet_table.html index 1d99f27..b943351 100644 --- a/templates/wallet_table.html +++ b/templates/wallet_table.html @@ -30,7 +30,6 @@ {{wallet.cave}} {% endif %} {% else %} - <em>No wallet.cave {{wallet.cave}}</em> {% endif %}</td> <td style="padding:2px">{% if wallet.name %}{{wallet.name}}{% else %}<em>{% if wallet.displaynames %} {% for dn in wallet.displaynames %}{{dn}}{%if not forloop.last %}, {% endif %} {% endfor %}{% else %} {% endif %}</em>{% endif %}</td> <td style="padding:2px" align=center>