debugging ticklist

This commit is contained in:
Philip Sargent
2022-08-01 02:50:19 +03:00
parent 5da1fce41f
commit 129ea3cc5b
5 changed files with 180 additions and 16 deletions

View File

@@ -85,11 +85,13 @@ def walletslistperson(request, first_name, last_name):
#personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower())
earliest = datetime.datetime.now().date()
manywallets = []
wallets = Wallet.objects.all()
wallets = Wallet.objects.all()
for w in wallets:
w.persons = w.people() # ephemeral attribute for web page
w.ticks = {} # ephemeral tick boxes display
# check if there is a json
if not w.get_json():
populatewallet(w)
@@ -102,18 +104,20 @@ def walletslistperson(request, first_name, last_name):
nobody = wp[0].lower()
if nobody == 'unknown' or nobody == 'nobody' or nobody == ' ':
populatewallet(w)
if w.persons:
if p.fullname in w.persons:
#found person
manywallets.append(w)
if not w.date():
datewallet(w, earliest)
c = w.cave()
if not c:
caveifywallet(w)
if not w.date():
datewallet(w, earliest)
c = w.cave()
if not c:
caveifywallet(w)
w.ticks = w.get_ticks() # the complaints in colour form
return render(request, 'personwallets.html', { 'manywallets':manywallets, 'settings': settings, 'person': p})
def walletslistyear(request, year):

View File

@@ -100,6 +100,9 @@ xlate = {"url": "description url",
def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl):
'''Taken from old script wallets.py and edited to make more comprehensible
Loads the survex files names and processes all complaints
All needs to be restructred to use the get_ticks() function on the Wallets class in core/models/survex.py
which does the same thing
'''
# Date
if not waldata["date"]:
@@ -134,20 +137,21 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl):
# Notes required
if not waldata["electronic survey"]:
notes_scanned = reduce(operator.or_, [f.startswith("note") for f in files], False)
notes_scanned = reduce(operator.or_, [f.endswith("note") for f in files], notes_scanned)
notes_scanned = reduce(operator.or_, [Path(f).stem.endswith("notes") for f in files], notes_scanned)
if not notes_scanned:
complaints.append("The notes needs scanning (or renaming): no noteNN.jpg or XXnote.jpg file found; and this is not an electronic survey.")
# Plan drawing required
plan_scanned = reduce(operator.or_, [f.startswith("plan") for f in files], False)
plan_scanned = reduce(operator.or_, [f.endswith("plan") for f in files], plan_scanned)
plan_scanned = reduce(operator.or_, [Path(f).stem.endswith("plan") for f in files], plan_scanned)
plan_drawing_required = not (plan_scanned or waldata["plan drawn"] or waldata["plan not required"])
if plan_drawing_required:
complaints.append("The plan needs drawing (or renaming, or tick 'Plan drawn' checkbox or 'Plan not required' checkbox): no planNN.jpg or XXplan.jpg file found.")
# Elev drawing required
elev_scanned = reduce(operator.or_, [f.startswith("elev") for f in files], False)
elev_scanned = reduce(operator.or_, [f.endswith("elev") for f in files], elev_scanned)
elev_scanned = reduce(operator.or_, [Path(f).stem.endswith("elev") for f in files], elev_scanned)
elev_scanned = reduce(operator.or_, [Path(f).stem.endswith("elevation") for f in files], elev_scanned)
elev_drawing_required = not (elev_scanned or waldata["elev drawn"] or waldata["elev not required"])
if elev_drawing_required:
complaints.append("The elevation needs drawing (or renaming, or tick 'Elev drawn' checkbox or 'Elev not required' checkbox): no elevNN.jpg or XXelev.jpg file found.")