forked from expo/troggle
bugfixes and enabling older wallets to be found and listed
This commit is contained in:
parent
af88cb4d0f
commit
aa20692ad6
@ -225,6 +225,8 @@ class Wallet(models.Model):
|
|||||||
return waldata
|
return waldata
|
||||||
|
|
||||||
def year(self):
|
def year(self):
|
||||||
|
if len(self.walletname) < 5:
|
||||||
|
return None
|
||||||
if self.walletname[4] != "#":
|
if self.walletname[4] != "#":
|
||||||
return None
|
return None
|
||||||
year = int(self.walletname[0:4])
|
year = int(self.walletname[0:4])
|
||||||
@ -352,8 +354,11 @@ class Wallet(models.Model):
|
|||||||
ticks["Q"] = "green"
|
ticks["Q"] = "green"
|
||||||
else:
|
else:
|
||||||
ticks["Q"] = survexok
|
ticks["Q"] = survexok
|
||||||
if int(self.year()) < 2015:
|
if not self.year():
|
||||||
ticks["Q"] = "lightgrey"
|
ticks["Q"] = "darkgrey"
|
||||||
|
else:
|
||||||
|
if int(self.year()) < 2015:
|
||||||
|
ticks["Q"] = "lightgrey"
|
||||||
|
|
||||||
|
|
||||||
# Notes, Plan, Elevation; Tunnel
|
# Notes, Plan, Elevation; Tunnel
|
||||||
|
@ -359,7 +359,7 @@ def scanupload(request, path=None):
|
|||||||
|
|
||||||
year = wallet[:4]
|
year = wallet[:4]
|
||||||
try:
|
try:
|
||||||
if int(year) <= 1998:
|
if wallet[4]!= "#":
|
||||||
#print(f'! - FORM scanupload - start {wallet} REDIRECT TO OLDWALLET')
|
#print(f'! - FORM scanupload - start {wallet} REDIRECT TO OLDWALLET')
|
||||||
return(oldwallet(request, path))
|
return(oldwallet(request, path))
|
||||||
except:
|
except:
|
||||||
|
@ -100,25 +100,32 @@ def load_all_scans():
|
|||||||
for walletname, fpath, fisdir in GetListDir(settings.SCANS_ROOT):
|
for walletname, fpath, fisdir in GetListDir(settings.SCANS_ROOT):
|
||||||
if not fisdir:
|
if not fisdir:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# do the year folders
|
for walletname, fpath, fisdir in GetListDir(fpath):
|
||||||
if re.match(r"\d\d\d\d$", walletname):
|
if fisdir:
|
||||||
print(f"{walletname}", end=' ')
|
wallet = Wallet(fpath=fpath, walletname=walletname)
|
||||||
for walletname, fpath, fisdir in GetListDir(fpath):
|
# this is where we should record the year explicitly
|
||||||
if fisdir:
|
# line 347 of view/uploads.py and needs refactoring for loading contentsjson
|
||||||
wallet = Wallet(fpath=fpath, walletname=walletname)
|
CheckEmptyDate(wallet)
|
||||||
# this is where we should load the contents.json for people, cave and date so we can report on them later
|
CheckEmptyPeople(wallet)
|
||||||
# this is where we should record the year explicitly
|
wallet.save()
|
||||||
# line 347 of view/uploads.py and needs refactoring for loading contentsjson
|
LoadListScansFile(wallet)
|
||||||
CheckEmptyDate(wallet)
|
|
||||||
CheckEmptyPeople(wallet)
|
# # do the year folders
|
||||||
wallet.save()
|
# if re.match(r"\d\d\d\d$", walletname):
|
||||||
LoadListScansFile(wallet)
|
# print(f"{walletname}", end=' ')
|
||||||
|
# for walletname, fpath, fisdir in GetListDir(fpath):
|
||||||
|
# if fisdir:
|
||||||
else:
|
# wallet = Wallet(fpath=fpath, walletname=walletname)
|
||||||
# but We *should* load all the scans, even for nonstandard names.
|
# # this is where we should record the year explicitly
|
||||||
print(f'\n - IGNORE {walletname} - {fpath}')
|
# # 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
|
# but we also need to check if JSON exists, even if there are no uploaded scan files
|
||||||
contents_path = Path(settings.DRAWINGS_DATA, "walletjson")
|
contents_path = Path(settings.DRAWINGS_DATA, "walletjson")
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
{{wallet.cave}}
|
{{wallet.cave}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<em>No wallet.cave {{wallet.cave}}</em>
|
|
||||||
{% endif %}</td>
|
{% 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">{% 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>
|
<td style="padding:2px" align=center>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user