mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-11-22 07:11:55 +00:00
2018 version
This commit is contained in:
parent
008c3c1c39
commit
28de577c8a
@ -2,7 +2,7 @@
|
||||
import os, operator, urllib, json, re
|
||||
|
||||
|
||||
loser_dir = "/home/expo/loser"
|
||||
loser_dir = "/home/expo/loser/"
|
||||
html_base = "<html><body>%(body)s</body></html>"
|
||||
html_year_index = html_base % {"body": "<H1>%(year)s surveys</H1><H2>Persons</H2><UL>%(persons)s</UL><H2>Wallets</H2><table>%(wallets)s</table><H2>Needing Scanning</H2><ul>%(needing scanning)s</ul><H2>Website needing updating</H2><ul>%(website needing updating)s</ul>"}
|
||||
html_year_person = "<li><a href='%(person)s.html'>%(person)s</a><ul>%(complaints)s</ul></li>"
|
||||
@ -33,7 +33,7 @@ blank_json = {"survex file": "",
|
||||
"electronic survey": False,
|
||||
"elev not required": False,
|
||||
"date": "",
|
||||
"people": [],
|
||||
"people": ["Unknown"],
|
||||
"description url": "",
|
||||
"cave": "",
|
||||
"name": ""}
|
||||
@ -51,15 +51,16 @@ for item in os.listdir("."):
|
||||
if os.path.isdir(item):
|
||||
files = []
|
||||
for f in os.listdir(os.path.join(".", item)):
|
||||
if f not in ["contents.json", "index.html"] and os.path.isfile(os.path.join(".", item, f)):
|
||||
if f not in ["contents.json", "contents.json~","index.html"] and os.path.isfile(os.path.join(".", item, f)):
|
||||
files.append(f)
|
||||
contents_path = os.path.join(".", item, "contents.json")
|
||||
print "Reading file %s" % (contents_path)
|
||||
if not os.path.isfile(contents_path):
|
||||
json_file = open(contents_path, "w")
|
||||
json.dump(blank_json, json_file, indent = 1)
|
||||
json_file.close()
|
||||
json_file = open(contents_path)
|
||||
print json_file
|
||||
#print json_file
|
||||
data = json.load(json_file)
|
||||
json_file.close()
|
||||
write_required = False
|
||||
@ -96,7 +97,7 @@ for item in os.listdir("."):
|
||||
if not data["survex not required"] and data["survex file"] == "":
|
||||
survex_complaint = "A survex file is required, but has not been specified!"
|
||||
if not data["survex not required"] and not os.path.isfile(os.path.join(loser_dir, data["survex file"])):
|
||||
survex_complaint = "The specified survex file does not exist here!"
|
||||
survex_complaint = "The specified survex file (%s) does not exist here!" % data["survex file"]
|
||||
complaints = []
|
||||
person_complaints = []
|
||||
if survex_required:
|
||||
@ -106,17 +107,17 @@ for item in os.listdir("."):
|
||||
#Notes
|
||||
notes_scanned = reduce(operator.or_, [f.startswith("note") for f in files], False)
|
||||
if not notes_scanned:
|
||||
complaints.append("The notes needs scanning")
|
||||
complaints.append("The notes needs scanning (no noteN.jpg file found)")
|
||||
wallets_needing_scanning.add(item)
|
||||
|
||||
#Plan drawing required
|
||||
plan_scanned = reduce(operator.or_, [f.startswith("plan") for f in files], False)
|
||||
plan_drawing_required = not (plan_scanned or data["plan drawn"])
|
||||
if plan_drawing_required:
|
||||
complaints.append("The plan needs drawing")
|
||||
person_complaints.append(" plan(s) needs drawing")
|
||||
complaints.append("The plan needs drawing (no planN.jpg file found)")
|
||||
person_complaints.append(" plan(s) needs drawing (no planN.jpg file found)")
|
||||
if not plan_drawing_required and not plan_scanned:
|
||||
complaints.append("The plan needs scanning")
|
||||
complaints.append("The plan needs scanning (no planN.jpg file found)")
|
||||
wallets_needing_scanning.add(item)
|
||||
|
||||
|
||||
@ -124,10 +125,10 @@ for item in os.listdir("."):
|
||||
elev_scanned = reduce(operator.or_, [f.startswith("elev") for f in files], False)
|
||||
elev_drawing_required = not (elev_scanned or data["elev drawn"])
|
||||
if elev_drawing_required:
|
||||
complaints.append("The elev needs drawing")
|
||||
person_complaints.append(" elev(s) needs drawing")
|
||||
complaints.append("The elev needs drawing (no elevN.jpg file found)")
|
||||
person_complaints.append(" elev(s) needs drawing (no elevN.jpg file found)")
|
||||
if not elev_drawing_required and not elev_scanned:
|
||||
complaints.append("The elev needs scanning")
|
||||
complaints.append("The elev needs scanning (no elevN.jpg file found)")
|
||||
wallets_needing_scanning.add(item)
|
||||
|
||||
#Description
|
||||
@ -137,8 +138,8 @@ for item in os.listdir("."):
|
||||
|
||||
#QMS
|
||||
if not data["qms written"]:
|
||||
complaints.append("The qms needs writing")
|
||||
person_complaints.append(" set(s) of qms needs writing")
|
||||
complaints.append("The QMs needs writing")
|
||||
person_complaints.append(" set(s) of QMs needs writing")
|
||||
|
||||
#Website
|
||||
if not data["website updated"]:
|
||||
@ -173,6 +174,11 @@ for item in os.listdir("."):
|
||||
wallets.append((item, data["cave"], data["name"], survex_required, plan_scanned, elev_scanned, data["description written"], data["qms written"]))
|
||||
|
||||
#People
|
||||
|
||||
for person in data["people"]:
|
||||
# delete all person.html as we are recreating all the ones that matter and old ones have old data
|
||||
if os.path.isfile(person + ".html"):
|
||||
os.remove(person + ".html")
|
||||
if person_complaints:
|
||||
for person in data["people"]:
|
||||
if not people.has_key(person):
|
||||
|
Loading…
Reference in New Issue
Block a user