summaryrefslogtreecommitdiffstats
path: root/core/views
diff options
context:
space:
mode:
Diffstat (limited to 'core/views')
-rw-r--r--core/views/drawings.py2
-rw-r--r--core/views/scans.py12
-rw-r--r--core/views/uploads.py17
3 files changed, 22 insertions, 9 deletions
diff --git a/core/views/drawings.py b/core/views/drawings.py
index 5e60130..93a5573 100644
--- a/core/views/drawings.py
+++ b/core/views/drawings.py
@@ -42,7 +42,7 @@ def dwgfilesingle(request, path):
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?
'''
- tfile = Path(settings.DRAWINGS_DATA, path)
+ tfile = Path(settings.DRAWINGS_DATA, path.replace(":","#"))
if not tfile.is_file():
message = f'Drawing file not found in filesystem at \'{path}\' .'
return render(request, 'errors/generic.html', {'message': message})
diff --git a/core/views/scans.py b/core/views/scans.py
index ddaf9ae..78f436f 100644
--- a/core/views/scans.py
+++ b/core/views/scans.py
@@ -95,8 +95,11 @@ def fillblankothers(w):
c = w.cave()
if not c:
caveifywallet(w)
-
+def fixsurvextick(w, ticks):
+ ticks["S"] = w.fixsurvextick(ticks["S"])
+
+
def walletslistperson(request, first_name, last_name):
'''Page which displays a list of all the wallets for a specific person
HORRIBLE linear search through everything. Index and do SQL query properly
@@ -114,6 +117,7 @@ def walletslistperson(request, first_name, last_name):
manywallets.append(w)
fillblankothers(w)
w.ticks = w.get_ticks() # the complaints in colour form
+ fixsurvextick(w, w.ticks)
return manywallets
try:
@@ -143,7 +147,8 @@ def walletslistyear(request, year):
manywallets.append(w)
fillblankpeople(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:
continue
@@ -177,7 +182,8 @@ def cavewallets(request, caveid):
for w in manywallets:
fillblankpeople(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})
diff --git a/core/views/uploads.py b/core/views/uploads.py
index f46db92..860cba7 100644
--- a/core/views/uploads.py
+++ b/core/views/uploads.py
@@ -240,7 +240,7 @@ def scanupload(request, path=None):
git = settings.GIT
filesaved = False
actual_saved = []
-
+
def read_json():
'''Read JSON from the wallet metadata file in the repo
or fills with blank data if that files can't be read'''
@@ -472,7 +472,12 @@ def scanupload(request, path=None):
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 = ""
chkplannr = ""
chkpland = ""
@@ -565,14 +570,16 @@ def scanupload(request, path=None):
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.')
- if waldata["cave"]:
+ if "cave" in waldata:
cave = waldata["cave"] # text string
+ else:
+ cave = ""
if waldata["name"]:
psg = waldata["name"]
if not 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)
# print(f' - {caveobject=}')
@@ -586,7 +593,7 @@ def scanupload(request, path=None):
context = {'year': year, 'prev': prev, 'next': next, 'prevy': prevy, 'nexty': nexty,
'files': files, 'dirs': dirs, 'waldata': waldata, 'svxfiles': svxfiles,
'checked': checked,
- 'create': create,
+ 'create': create, 'metadataurl': metadataurl,
'complaints': complaints,
'caveobject': caveobject,
'people': waldata["people"], 'peoplesize': str(len(str(waldata["people"]))),