forked from expo/troggle
fix green block for survex files on table
This commit is contained in:
parent
5c667c1826
commit
6452a7beed
@ -177,7 +177,7 @@ class Wallet(models.Model):
|
|||||||
return urljoin(settings.URL_ROOT, reverse('singlewallet', kwargs={"path":re.sub("#", "%23", self.walletname)}))
|
return urljoin(settings.URL_ROOT, reverse('singlewallet', kwargs={"path":re.sub("#", "%23", self.walletname)}))
|
||||||
|
|
||||||
def get_json(self):
|
def get_json(self):
|
||||||
jsonfile = Path(self.fpath, 'contents.json')
|
#jsonfile = Path(self.fpath, 'contents.json')
|
||||||
|
|
||||||
# Get from git repo instead
|
# Get from git repo instead
|
||||||
# :drawings: walletjson/2022/2022#01/contents.json
|
# :drawings: walletjson/2022/2022#01/contents.json
|
||||||
@ -252,6 +252,13 @@ class Wallet(models.Model):
|
|||||||
pass
|
pass
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
def fixsurvextick(self, tick):
|
||||||
|
blocks = SurvexBlock.objects.filter(scanswallet = self)
|
||||||
|
result = tick
|
||||||
|
for b in blocks:
|
||||||
|
if b.survexfile: # if any exist in db, no check for validity or a real file. Refactor.
|
||||||
|
result = "seagreen" # slightly different shade of green
|
||||||
|
return result
|
||||||
|
|
||||||
def get_ticks(self):
|
def get_ticks(self):
|
||||||
ticks = {}
|
ticks = {}
|
||||||
|
@ -42,7 +42,7 @@ def dwgfilesingle(request, path):
|
|||||||
webpage /dwgupload/... if the user types the filename into the browser bar. Could be a problem?
|
webpage /dwgupload/... if the user types the filename into the browser bar. Could be a problem?
|
||||||
Should we validate using uploads.py dwgvaliddisp() here too?
|
Should we validate using uploads.py dwgvaliddisp() here too?
|
||||||
'''
|
'''
|
||||||
tfile = Path(settings.DRAWINGS_DATA, path)
|
tfile = Path(settings.DRAWINGS_DATA, path.replace(":","#"))
|
||||||
if not tfile.is_file():
|
if not tfile.is_file():
|
||||||
message = f'Drawing file not found in filesystem at \'{path}\' .'
|
message = f'Drawing file not found in filesystem at \'{path}\' .'
|
||||||
return render(request, 'errors/generic.html', {'message': message})
|
return render(request, 'errors/generic.html', {'message': message})
|
||||||
|
@ -96,6 +96,9 @@ def fillblankothers(w):
|
|||||||
if not c:
|
if not c:
|
||||||
caveifywallet(w)
|
caveifywallet(w)
|
||||||
|
|
||||||
|
def fixsurvextick(w, ticks):
|
||||||
|
ticks["S"] = w.fixsurvextick(ticks["S"])
|
||||||
|
|
||||||
|
|
||||||
def walletslistperson(request, first_name, last_name):
|
def walletslistperson(request, first_name, last_name):
|
||||||
'''Page which displays a list of all the wallets for a specific person
|
'''Page which displays a list of all the wallets for a specific person
|
||||||
@ -114,6 +117,7 @@ def walletslistperson(request, first_name, last_name):
|
|||||||
manywallets.append(w)
|
manywallets.append(w)
|
||||||
fillblankothers(w)
|
fillblankothers(w)
|
||||||
w.ticks = w.get_ticks() # the complaints in colour form
|
w.ticks = w.get_ticks() # the complaints in colour form
|
||||||
|
fixsurvextick(w, w.ticks)
|
||||||
return manywallets
|
return manywallets
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -143,7 +147,8 @@ def walletslistyear(request, year):
|
|||||||
manywallets.append(w)
|
manywallets.append(w)
|
||||||
fillblankpeople(w)
|
fillblankpeople(w)
|
||||||
fillblankothers(w)
|
fillblankothers(w)
|
||||||
w.ticks = w.get_ticks() # the complaints in colour form
|
w.ticks = w.get_ticks() # the complaints in colour form, from the json file on disc
|
||||||
|
fixsurvextick(w, w.ticks)
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -177,7 +182,8 @@ def cavewallets(request, caveid):
|
|||||||
for w in manywallets:
|
for w in manywallets:
|
||||||
fillblankpeople(w)
|
fillblankpeople(w)
|
||||||
fillblankothers(w)
|
fillblankothers(w)
|
||||||
w.ticks = w.get_ticks() # the complaints in colour form
|
w.ticks = w.get_ticks() # the complaints in colour form, from the json file on disc
|
||||||
|
fixsurvextick(w, w.ticks)
|
||||||
return render(request, 'cavewallets.html', { 'manywallets':manywallets, 'settings': settings, 'cave': cave})
|
return render(request, 'cavewallets.html', { 'manywallets':manywallets, 'settings': settings, 'cave': cave})
|
||||||
|
|
||||||
|
|
||||||
|
@ -472,7 +472,12 @@ def scanupload(request, path=None):
|
|||||||
|
|
||||||
waldata = read_json()
|
waldata = read_json()
|
||||||
|
|
||||||
cave =""
|
jsonfile = Path(settings.DRAWINGS_DATA, "walletjson") / wallet[0:4] / wallet / "contents.json"
|
||||||
|
print(f'! - FORM scanupload - jsonfile {jsonfile}')
|
||||||
|
if not Path(jsonfile).is_file():
|
||||||
|
metadataurl = ""
|
||||||
|
else:
|
||||||
|
metadataurl = Path("/dwgdataraw", "walletjson") / wallet[0:4] / wallet.replace("#",":") / "contents.json"
|
||||||
psg = ""
|
psg = ""
|
||||||
chkplannr = ""
|
chkplannr = ""
|
||||||
chkpland = ""
|
chkpland = ""
|
||||||
@ -565,14 +570,16 @@ def scanupload(request, path=None):
|
|||||||
waldata["name"] = f"several, please edit: {names}"
|
waldata["name"] = f"several, please edit: {names}"
|
||||||
print(f' - More than one block name is relevant {names} in this wallet {wallet}. Not managed in this troggle release.')
|
print(f' - More than one block name is relevant {names} in this wallet {wallet}. Not managed in this troggle release.')
|
||||||
|
|
||||||
if waldata["cave"]:
|
if "cave" in waldata:
|
||||||
cave = waldata["cave"] # text string
|
cave = waldata["cave"] # text string
|
||||||
|
else:
|
||||||
|
cave = ""
|
||||||
if waldata["name"]:
|
if waldata["name"]:
|
||||||
psg = waldata["name"]
|
psg = waldata["name"]
|
||||||
if not waldata["description url"]:
|
if not waldata["description url"]:
|
||||||
waldata["description url"]=""
|
waldata["description url"]=""
|
||||||
|
|
||||||
#Survex and survex complaints
|
#Survex and survex complaints, comes from json file on disc, not as pre-populated as above
|
||||||
complaints, caveobject = get_complaints([], waldata, svxfiles, files, wallet, wurl)
|
complaints, caveobject = get_complaints([], waldata, svxfiles, files, wallet, wurl)
|
||||||
# print(f' - {caveobject=}')
|
# print(f' - {caveobject=}')
|
||||||
|
|
||||||
@ -586,7 +593,7 @@ def scanupload(request, path=None):
|
|||||||
context = {'year': year, 'prev': prev, 'next': next, 'prevy': prevy, 'nexty': nexty,
|
context = {'year': year, 'prev': prev, 'next': next, 'prevy': prevy, 'nexty': nexty,
|
||||||
'files': files, 'dirs': dirs, 'waldata': waldata, 'svxfiles': svxfiles,
|
'files': files, 'dirs': dirs, 'waldata': waldata, 'svxfiles': svxfiles,
|
||||||
'checked': checked,
|
'checked': checked,
|
||||||
'create': create,
|
'create': create, 'metadataurl': metadataurl,
|
||||||
'complaints': complaints,
|
'complaints': complaints,
|
||||||
'caveobject': caveobject,
|
'caveobject': caveobject,
|
||||||
'people': waldata["people"], 'peoplesize': str(len(str(waldata["people"]))),
|
'people': waldata["people"], 'peoplesize': str(len(str(waldata["people"]))),
|
||||||
|
@ -98,6 +98,7 @@
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
{% if not create %}
|
{% if not create %}
|
||||||
<br>
|
<br>
|
||||||
<span style="font-family: monospace; font-size: 150%; ">
|
<span style="font-family: monospace; font-size: 150%; ">
|
||||||
@ -113,8 +114,10 @@
|
|||||||
<a href="/survexfile/{{svx}}">{{svx}}</a>
|
<a href="/survexfile/{{svx}}">{{svx}}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<br><br>
|
<br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if metadataurl %}<u>Debug</u>: <a href="{{metadataurl}}">json file</a><br> {% endif %}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
<span style="font-family: monospace; font-size: 130%; ">
|
<span style="font-family: monospace; font-size: 130%; ">
|
||||||
<!--
|
<!--
|
||||||
|
Loading…
x
Reference in New Issue
Block a user