forked from expo/troggle
tick lists now on 3 wallets reports
This commit is contained in:
parent
df42b1ccb3
commit
eed35d01a8
@ -31,14 +31,6 @@ manywallets dict.
|
||||
def populatewallet(w):
|
||||
'''Copy survex data here just for display, not permanently
|
||||
'''
|
||||
# {% for personrole in wallet.survexblock.survexpersonrole_set.all %}
|
||||
# {% if personrole.personexpedition %}
|
||||
# <a href="{{personrole.personexpedition.get_absolute_url}}">{{personrole.personname}}</a>
|
||||
# {% else %}
|
||||
# {{personrole.personname}}
|
||||
# {% endif %}
|
||||
# {% endfor %}
|
||||
|
||||
survexpeople = []
|
||||
blocks = SurvexBlock.objects.filter(scanswallet = w)
|
||||
for b in blocks:
|
||||
@ -60,11 +52,34 @@ def datewallet(w, earliest):
|
||||
w.date = first
|
||||
|
||||
def caveifywallet(w):
|
||||
'''Gets the cave from the list of survex files,
|
||||
only selects one of them though. Only used for display.
|
||||
'''
|
||||
blocks = SurvexBlock.objects.filter(scanswallet = w)
|
||||
for b in blocks:
|
||||
# NB b.cave is not populated by parser. Use b.survexfile.cave instead, or we could parse b.survexpath
|
||||
if b.survexfile.cave:
|
||||
w.cave = b.survexfile.cave # just gets the last one, randomly
|
||||
w.cave = b.survexfile.cave # just gets the last one, randomly. SHould make this a list or many:many ideally
|
||||
|
||||
def fillblankpeople(w):
|
||||
wp = w.people()
|
||||
if not wp: # an -empty list
|
||||
populatewallet(w)
|
||||
else:
|
||||
if len(wp) == 1:
|
||||
nobody = wp[0].lower()
|
||||
if nobody == 'unknown' or nobody == 'nobody' or nobody == ' ':
|
||||
populatewallet(w)
|
||||
|
||||
def fillblankothers(w):
|
||||
earliest = datetime.datetime.now().date()
|
||||
if not w.date():
|
||||
datewallet(w, earliest)
|
||||
|
||||
c = w.cave()
|
||||
if not c:
|
||||
caveifywallet(w)
|
||||
|
||||
|
||||
def walletslistperson(request, first_name, last_name):
|
||||
'''Page which displays a list of all the wallets for a specific person
|
||||
@ -72,6 +87,18 @@ def walletslistperson(request, first_name, last_name):
|
||||
'''
|
||||
# This is where we face having to re-do everything to do with names properly, rather than the horrible series of hacks over 20 years..
|
||||
#GetPersonExpeditionNameLookup
|
||||
def tickspersonwallet(p):
|
||||
manywallets = []
|
||||
wallets = Wallet.objects.all()
|
||||
for w in wallets:
|
||||
w.persons = w.people() # ephemeral attribute for web page
|
||||
fillblankpeople(w)
|
||||
if w.persons:
|
||||
if p.fullname in w.persons:
|
||||
manywallets.append(w)
|
||||
fillblankothers(w)
|
||||
w.ticks = w.get_ticks() # the complaints in colour form
|
||||
return manywallets
|
||||
|
||||
try:
|
||||
if last_name:
|
||||
@ -83,78 +110,36 @@ def walletslistperson(request, first_name, last_name):
|
||||
#raise
|
||||
return render(request, 'errors/generic.html', {'message': f'Unrecognised name of a expo person: "{first_name} {last_name}"'})
|
||||
|
||||
#personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower())
|
||||
earliest = datetime.datetime.now().date()
|
||||
|
||||
|
||||
manywallets = []
|
||||
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)
|
||||
else:
|
||||
wp = w.people()
|
||||
if not wp: # an -empty list
|
||||
populatewallet(w)
|
||||
else:
|
||||
if len(wp) == 1:
|
||||
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)
|
||||
|
||||
w.ticks = w.get_ticks() # the complaints in colour form
|
||||
manywallets = tickspersonwallet(p)
|
||||
|
||||
return render(request, 'personwallets.html', { 'manywallets':manywallets, 'settings': settings, 'person': p})
|
||||
|
||||
|
||||
def walletslistyear(request, year):
|
||||
'''Page which displays a list of all the wallets in a specific year
|
||||
'''
|
||||
if year < 1976 or year > 2050:
|
||||
return render(request, 'errors/generic.html', {'message': 'Year out of range. Must be between 1976 and 2050'})
|
||||
else:
|
||||
year = str(year)
|
||||
#return render(request, 'errors/generic.html', {'message': 'This page logic not implemented yet'})
|
||||
earliest = datetime.datetime.now().date()
|
||||
|
||||
def ticksyearwallet(year):
|
||||
manywallets = []
|
||||
wallets = Wallet.objects.all()
|
||||
for w in wallets:
|
||||
|
||||
if year == w.year():
|
||||
print(w.year(), w)
|
||||
manywallets.append(w)
|
||||
fillblankpeople(w)
|
||||
fillblankothers(w)
|
||||
w.ticks = w.get_ticks() # the complaints in colour form
|
||||
else:
|
||||
continue
|
||||
|
||||
wp = w.people()
|
||||
if not wp: # an -empty list
|
||||
populatewallet(w)
|
||||
return manywallets
|
||||
|
||||
if year < 1976 or year > 2050:
|
||||
return render(request, 'errors/generic.html', {'message': 'Year out of range. Must be between 1976 and 2050'})
|
||||
else:
|
||||
if len(wp) == 1:
|
||||
nobody = wp[0].lower()
|
||||
if nobody == 'unknown' or nobody == 'nobody' or nobody == ' ':
|
||||
populatewallet(w)
|
||||
year = str(year)
|
||||
#return render(request, 'errors/generic.html', {'message': 'This page logic not implemented yet'})
|
||||
|
||||
if not w.date():
|
||||
datewallet(w, earliest)
|
||||
|
||||
c = w.cave()
|
||||
if not c:
|
||||
caveifywallet(w)
|
||||
manywallets = ticksyearwallet(year)
|
||||
|
||||
return render(request, 'yearwallets.html', { 'manywallets':manywallets, 'settings': settings, 'year': year})
|
||||
|
||||
@ -163,39 +148,23 @@ def walletslistyear(request, year):
|
||||
def cavewallets(request, caveid):
|
||||
'''Returns all the wallets for just one cave
|
||||
'''
|
||||
|
||||
Gcavelookup = GetCaveLookup()
|
||||
if caveid in Gcavelookup:
|
||||
cave = Gcavelookup[caveid]
|
||||
else:
|
||||
return render(request,'errors/badslug.html', {'badslug': caveid})
|
||||
|
||||
earliest = datetime.datetime.now().date()
|
||||
|
||||
# remove duplication. SOrting is done in the template
|
||||
wallets = set(Wallet.objects.filter(survexblock__survexfile__cave=cave)) # NB a filtered set
|
||||
manywallets = list(wallets)
|
||||
|
||||
|
||||
for w in manywallets:
|
||||
wp = w.people()
|
||||
if not wp: # an -empty list
|
||||
populatewallet(w)
|
||||
else:
|
||||
if len(wp) == 1:
|
||||
nobody = wp[0].lower()
|
||||
if nobody == 'unknown' or nobody == 'nobody' or nobody == ' ':
|
||||
populatewallet(w)
|
||||
|
||||
if not w.date():
|
||||
datewallet(w, earliest)
|
||||
|
||||
c = w.cave()
|
||||
if not c:
|
||||
caveifywallet(w)
|
||||
|
||||
fillblankpeople(w)
|
||||
fillblankothers(w)
|
||||
w.ticks = w.get_ticks() # the complaints in colour form
|
||||
return render(request, 'cavewallets.html', { 'manywallets':manywallets, 'settings': settings, 'cave': cave})
|
||||
|
||||
|
||||
def oldwallet(request, path):
|
||||
'''Now called only for non-standard wallet structures for pre-2000 wallets
|
||||
'''
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
<div id="nav">
|
||||
{% block nav %}
|
||||
<!-- Use id="nav" for the left side menu -->
|
||||
<!-- Not used any more? -->
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
@ -67,7 +67,6 @@
|
||||
|
||||
<div id="related">
|
||||
{% block related %}
|
||||
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% block content %}
|
||||
|
@ -14,8 +14,9 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
<ul>
|
||||
<li>per year, e.g. <a href="/wallets/year/2019">2019</a>
|
||||
<li>per person, e.g. <a href="/wallets/person/MichaelSargent">Michael Sargent</a>
|
||||
|
||||
</ul>
|
||||
{% include 'wallet_table.html' %}
|
||||
<br />
|
||||
<table width=95%>
|
||||
<tr><th>Wallet</th><th width=8%>Wallet Date</th><th>Wallet Name</th><th>People</th><th>Scans</th><th>Survex blocks</th><th>Drawings using these scans</th></tr>
|
||||
{% for wallet in manywallets|dictsort:"walletname" %}
|
||||
@ -33,7 +34,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
||||
<td style="padding:2px">
|
||||
<td style="padding:2px; font-size: 70%;">
|
||||
{% for drawing in wallet.drawingfile_set.all %}
|
||||
<a href="{% url "dwgfilesingle" drawing.dwgpath %}">{{drawing.dwgpath}}</a><br>
|
||||
{% empty %}
|
||||
|
@ -15,46 +15,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
<li>per cave, e.g. <a href="/cave/scans/1623-161">1623/161</a>
|
||||
</ul>
|
||||
|
||||
|
||||
<table width=95%>
|
||||
<tr><th>Wallet</th><th width=8%>Wallet Date</th><th>Cave</th><th>Wallet Name</th>
|
||||
|
||||
<!-- survex file-->
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Survex data">S</th>
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Survex Cave Description">C</th>
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Survex QMs">Q</th>
|
||||
|
||||
|
||||
<!-- scanned-->
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Notes">N</th>
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Plan">P</th>
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Elevation">E</th>
|
||||
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Tunnel or Therion">T</th>
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Website updated">W</th>
|
||||
|
||||
</tr>
|
||||
{% for wallet in manywallets|dictsort:"walletname" %}
|
||||
<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">{{wallet.cave}}</td>
|
||||
<td style="padding:2px">{{wallet.name}}</td>
|
||||
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.S}}"> </td>
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.C}}"> </td>
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.Q}}"> </td>
|
||||
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.N}}"> </td>
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.P}}"> </td>
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.E}}"> </td>
|
||||
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.T}}"> </td>
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.W}}"> </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% include 'wallet_table.html' %}
|
||||
<br />
|
||||
<table width=95%>
|
||||
<tr><th>Wallet</th><th width=8%>Wallet Date</th><th>Wallet Name</th><th width=15%>Other People</th><th>Cave</th><th>Scans</th><th>Survex blocks</th><th>Drawings using these scans</th></tr>
|
||||
@ -74,7 +35,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
||||
<td style="padding:2px">
|
||||
<td style="padding:2px; font-size: 70%;">
|
||||
{% for drawing in wallet.drawingfile_set.all %}
|
||||
<a href="{% url "dwgfilesingle" drawing.dwgpath %}">{{drawing.dwgpath}}</a><br>
|
||||
{% empty %}
|
||||
|
40
templates/wallet_table.html
Normal file
40
templates/wallet_table.html
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
<table width=95%>
|
||||
<tr><th>Wallet</th><th width=8%>Wallet Date</th><th>Cave</th><th>Wallet Name</th>
|
||||
|
||||
<!-- survex file-->
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Survex data">S</th>
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Survex Cave Description">C</th>
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Survex QMs">Q</th>
|
||||
|
||||
|
||||
<!-- scanned-->
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Notes">N</th>
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Plan">P</th>
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Elevation">E</th>
|
||||
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Tunnel or Therion">T</th>
|
||||
<th style="font-family: monospace; font-size: 150%;" title="Website updated">W</th>
|
||||
|
||||
</tr>
|
||||
{% for wallet in manywallets|dictsort:"walletname" %}
|
||||
<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">{{wallet.cave}}</td>
|
||||
<td style="padding:2px">{{wallet.name}}</td>
|
||||
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.S}}"> </td>
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.C}}"> </td>
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.Q}}"> </td>
|
||||
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.N}}"> </td>
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.P}}"> </td>
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.E}}"> </td>
|
||||
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.T}}"> </td>
|
||||
<td style="padding:1px; background-color:{{wallet.ticks.W}}"> </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
@ -14,6 +14,9 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
<li>per cave, e.g. <a href="/cave/scans/1623-161">1623/161</a>
|
||||
<li>per person, e.g. <a href="/wallets/person/MichaelSargent">Michael Sargent</a>
|
||||
</ul>
|
||||
|
||||
{% include 'wallet_table.html' %}
|
||||
<br />
|
||||
<table width=95%>
|
||||
<tr><th>Wallet</th><th width=8%>Wallet Date</th><th>Wallet Name</th><th>People</th><th>Cave</th><th>Scans</th><th>Survex blocks</th><th>Drawings using these scans</th></tr>
|
||||
{% for wallet in manywallets|dictsort:"walletname" %}
|
||||
@ -32,7 +35,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
||||
<td style="padding:2px">
|
||||
<td style="padding:2px; font-size: 70%;">
|
||||
{% for drawing in wallet.drawingfile_set.all %}
|
||||
<a href="{% url "dwgfilesingle" drawing.dwgpath %}">{{drawing.dwgpath}}</a><br>
|
||||
{% empty %}
|
||||
|
Loading…
Reference in New Issue
Block a user