mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 00:31:55 +00:00
formatting
This commit is contained in:
parent
c1aaf07885
commit
0fd3cf43e8
@ -178,15 +178,14 @@ def oldwallet(request, path):
|
||||
return render(request, 'errors/generic.html', {'message': message})
|
||||
|
||||
def walletindex(request, path):
|
||||
'''All years: special 'wallet' for scanned index pages
|
||||
'''All years: special 'wallet' for *scanned* index pages
|
||||
'''
|
||||
# print([ s.walletname for s in Wallet.objects.all() ])
|
||||
print(f'! - walletindex path:{path}')
|
||||
try:
|
||||
wallet = Wallet.objects.get(walletname=urlunquote(path))
|
||||
return render(request, 'walletindex.html', { 'wallet':wallet, 'settings': settings })
|
||||
except:
|
||||
message = f'Scan folder error or not found \'{path}\' .'
|
||||
message = f'Scan folder (wallet) error or not found \'{path}\' .'
|
||||
return render(request, 'errors/generic.html', {'message': message})
|
||||
|
||||
def scansingle(request, path, file):
|
||||
|
@ -101,9 +101,10 @@ 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
|
||||
'''
|
||||
w = Wallet.objects.get(walletname=wallet)
|
||||
ticks = w.get_ticks()
|
||||
|
||||
# Date
|
||||
if not waldata["date"]:
|
||||
complaints.append("A date is mandatory. No data can be updated or edited unless you specify a date. Look in the survex file if there is one.")
|
||||
@ -111,7 +112,8 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl):
|
||||
# People
|
||||
if waldata["people"]==["NOBODY"] or waldata["people"]==["Unknown"]:
|
||||
complaints.append("Someody must have done this. Look in the survex file, or in the logbook entries for this date, for the people who created this data.")
|
||||
|
||||
|
||||
# survex, but get_ticks has already done much of this ??
|
||||
survex_complaint = ""
|
||||
|
||||
if waldata["survex file"]:
|
||||
@ -133,33 +135,23 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl):
|
||||
survex_complaint = "A survex file is required, but has not been specified!"
|
||||
if survex_complaint:
|
||||
complaints.append(survex_complaint)
|
||||
|
||||
|
||||
|
||||
# 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_, [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.")
|
||||
if ticks['N'] != "green":
|
||||
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_, [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.")
|
||||
if ticks['P'] != "green":
|
||||
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_, [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:
|
||||
if ticks['E'] != "green":
|
||||
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.")
|
||||
|
||||
# Electronic Surveys
|
||||
if not waldata["electronic survey"]:
|
||||
if elev_drawing_required or plan_drawing_required:
|
||||
complaints.append("Tunnel or Therion drawing files need drawing. Or if this an electronic survey, please tick the 'Electronic survey' checkbox.")
|
||||
# ETherion
|
||||
if ticks['T'] != "green":
|
||||
complaints.append("Tunnel or Therion drawing files need drawing. Or if this an electronic survey, please tick the 'Electronic survey' checkbox.")
|
||||
|
||||
# Description
|
||||
if not waldata["description written"]:
|
||||
@ -188,7 +180,7 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl):
|
||||
complaints.append(f'The cave ID \'{waldata["cave"]}\' is not recognised. Please fix it.')
|
||||
caveobject = None
|
||||
else:
|
||||
complaints.append(f'No cave ID is given. Please give an ID, even if it is just "surface survey" or "scraps found in hut"')
|
||||
complaints.append(f'No cave ID is given. Please give some text, even if it is just "surface survey" or "scraps found in hut"')
|
||||
caveobject = None
|
||||
|
||||
|
||||
@ -204,6 +196,8 @@ def scanupload(request, path=None):
|
||||
|
||||
This subsumes much of the code which was in the old wallets.py script and so this function is very long
|
||||
indeed and needs refactoring.
|
||||
|
||||
REWRITE bits using the ticklist, dateify, caveify, populate etc utility functions in core.view.scans.py
|
||||
'''
|
||||
filesaved = False
|
||||
actual_saved = []
|
||||
|
@ -15,6 +15,7 @@ import settings
|
||||
from troggle.core.models.survex import SingleScan, Wallet, DrawingFile
|
||||
from troggle.core.models.troggle import DataIssue
|
||||
from troggle.core.utils import save_carefully, GetListDir
|
||||
from troggle.core.views.scans import datewallet
|
||||
|
||||
'''Searches through all the survey scans directories (wallets) in expofiles, looking for images to be referenced.
|
||||
'''
|
||||
@ -61,10 +62,13 @@ wallet_blank_html = '''<html><body><H1>Wallet WALLET</H1>
|
||||
'''
|
||||
|
||||
def CheckEmptyDate(wallet):
|
||||
'''If date is not set, get it from a linked survex file. If several, pick the earliest.
|
||||
|
||||
Maybe also look at filedates for the scans in expofiles/surveyscans/ , but these can be re-set by copying.
|
||||
'''If date is not set, get it from a linked survex file.
|
||||
Could also look at filedates for the scans in expofiles/surveyscans/ , but these can be re-set by copying.
|
||||
'''
|
||||
earliest = datetime.datetime.now().date()
|
||||
|
||||
# This is not working, can't see why. An scans parser now taking a very long time..
|
||||
#datewallet(wallet, earliest)
|
||||
return
|
||||
|
||||
def CheckEmptyPeople(wallet):
|
||||
@ -73,6 +77,8 @@ def CheckEmptyPeople(wallet):
|
||||
To be a Troggle model change; a many:many relationship between wallets and people,
|
||||
as well as being a list in the JSON file (which is the permanent repository). We want the many:many
|
||||
relationship so that we can filter wallets based on a person.
|
||||
|
||||
For the moment, we will just get a list..
|
||||
'''
|
||||
return
|
||||
|
||||
@ -147,6 +153,7 @@ def load_all_scans():
|
||||
|
||||
# first do the smkhs (large kh survey scans) directory
|
||||
# this seems to be never used ?!
|
||||
#We should load all the scans, even for nonstandard names.
|
||||
manywallets_smkhs = Wallet(fpath=os.path.join(settings.SCANS_ROOT, "../surveys/smkhs"), walletname="smkhs")
|
||||
print("smkhs", end=' ')
|
||||
if os.path.isdir(manywallets_smkhs.fpath):
|
||||
@ -170,19 +177,14 @@ def load_all_scans():
|
||||
# this is where we should load the contents.json for people so we can report on them later
|
||||
# this is where we should record the year explicitly
|
||||
# line 347 of view/uploads.py and needs refactoring for loading contentsjson
|
||||
wallet.save()
|
||||
LoadListScansFile(wallet)
|
||||
CheckEmptyDate(wallet)
|
||||
CheckEmptyPeople(wallet)
|
||||
wallet.save()
|
||||
LoadListScansFile(wallet)
|
||||
CopyWalletData(wallet)
|
||||
|
||||
# what is this?
|
||||
# elif walletname != "thumbs":
|
||||
# print(f'\n - Wallet {walletname} - {fpath}')
|
||||
# wallet = Wallet(fpath=fpath, walletname=walletname)
|
||||
# wallet.save()
|
||||
# LoadListScansFile(wallet)
|
||||
|
||||
else:
|
||||
# but We should load all the scans, even for nonstandard names.
|
||||
print(f'\n - IGNORE {walletname} - {fpath}')
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
<tr>
|
||||
<td style="padding:2px"><a href="{{wallet.get_absolute_url}}">{{wallet.walletname}}</a></td>
|
||||
|
||||
<td style="padding:2px">{{wallet.date}}</td>
|
||||
<td style="padding:2px">{% if wallet.date %}{{wallet.date}}{% else %} {% endif %}</td>
|
||||
<td style="padding:2px">{{wallet.name}}</td>
|
||||
<td style="padding:2px">{{wallet.persons}}</td>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>See also the <a href="/years/{{expedition.year}}/">documentation index</a> for this Expo
|
||||
<p>See also the <a href="/expofiles/surveyscans/{{expedition.year}}/walletindex.html">wallet completion status</a> for this Expo
|
||||
<p>See also the <a href="/wallets/year/{{expedition.year}}">wallet completion status</a> for this Expo
|
||||
{% if logged_in %}
|
||||
<p>Reparse and reload this year's logbook by clicking here: <a href="/expedition/{{expedition.year}}?reload">RELOAD</a>
|
||||
{% endif %}
|
||||
|
@ -23,7 +23,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
<tr>
|
||||
<td style="padding:2px"><a href="{{wallet.get_absolute_url}}">{{wallet.walletname}}</a></td>
|
||||
|
||||
<td style="padding:2px" >{{wallet.date}}</td>
|
||||
<td style="padding:2px" >{% if wallet.date %}{{wallet.date}}{% else %} {% endif %}</td>
|
||||
<td style="padding:2px">{{wallet.name}}</td>
|
||||
<td style="padding:2px">{{wallet.persons}}</td>
|
||||
<td style="padding:2px">{{wallet.cave}}</td>
|
||||
|
@ -57,10 +57,10 @@ ul {list-style: disc}
|
||||
|
||||
<h3>Unfinished wallets work to do:</h3>
|
||||
<ul>
|
||||
<li><a href="/expofiles/surveyscans/2016/walletindex.html">2016 wallets</a><br>
|
||||
<li><a href="/expofiles/surveyscans/2017/walletindex.html">2017 wallets</a><br>
|
||||
<li><a href="/expofiles/surveyscans/2018/walletindex.html">2018 wallets</a><br>
|
||||
<li><a href="/expofiles/surveyscans/2019/walletindex.html">2019 wallets</a><br>
|
||||
<li><a href="/wallets/year/2016">2016 wallets</a><br>
|
||||
<li><a href="/wallets/year/2017">2017 wallets</a><br>
|
||||
<li><a href="/wallets/year/2018">2018 wallets</a><br>
|
||||
<li><a href="/wallets/year/2019">2019 wallets</a><br>
|
||||
</ul>
|
||||
|
||||
<h3>Upload new data</h3>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<tr>
|
||||
<td style="padding:2px"><a href="{{wallet.get_absolute_url}}">{{wallet.walletname}}</a></td>
|
||||
|
||||
<td style="padding:2px" >{{wallet.date}}</td>
|
||||
<td style="padding:2px" >{% if wallet.date %}{{wallet.date}}{% else %} {% endif %}</td>
|
||||
<td style="padding:2px">{{wallet.cave}}</td>
|
||||
<td style="padding:2px">{{wallet.name}}</td>
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
||||
{% endif %}
|
||||
|
||||
<p><em>
|
||||
<a href="/expofiles/surveyscans/{{year}}/walletindex.html">Wallet index for this year</a> (old script, being replaced...)
|
||||
<a href="/wallets/year/{{year}}">Wallet index for this year</a>
|
||||
<br />
|
||||
<a href="/expedition/{{year}}">Logbook entries, people, Survex files for {{year}}</a>
|
||||
</em>
|
||||
|
@ -23,7 +23,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
<tr>
|
||||
<td style="padding:2px"><a href="{{wallet.get_absolute_url}}">{{wallet.walletname}}</a></td>
|
||||
|
||||
<td style="padding:2px">{{wallet.date}}</td>
|
||||
<td style="padding:2px">{% if wallet.date %}{{wallet.date}}{% else %} {% endif %}</td>
|
||||
<td style="padding:2px">{{wallet.name}}</td>
|
||||
<td style="padding:2px">{{wallet.persons}}</td>
|
||||
<td style="padding:2px">{{wallet.cave}}</td>
|
||||
|
Loading…
Reference in New Issue
Block a user