mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 16:51:54 +00:00
Add survex files,wallets and same-day LBEs to the logbook entry
This commit is contained in:
parent
b60e1f2493
commit
fe28d9ba39
@ -15,7 +15,7 @@ from django.views.generic.list import ListView
|
|||||||
from troggle.core.models.troggle import Expedition, Person, PersonExpedition
|
from troggle.core.models.troggle import Expedition, Person, PersonExpedition
|
||||||
from troggle.core.utils import TROG
|
from troggle.core.utils import TROG
|
||||||
from troggle.core.models.caves import LogbookEntry, PersonTrip
|
from troggle.core.models.caves import LogbookEntry, PersonTrip
|
||||||
from troggle.core.models.survex import SurvexBlock
|
from troggle.core.models.survex import SurvexBlock, Wallet
|
||||||
from .auth import login_required_if_public
|
from .auth import login_required_if_public
|
||||||
from troggle.parsers.logbooks import LoadLogbookForExpedition
|
from troggle.parsers.logbooks import LoadLogbookForExpedition
|
||||||
from troggle.parsers.people import GetPersonExpeditionNameLookup
|
from troggle.parsers.people import GetPersonExpeditionNameLookup
|
||||||
@ -192,8 +192,28 @@ def logbookentry(request, date, slug):
|
|||||||
if len(this_logbookentry)>1:
|
if len(this_logbookentry)>1:
|
||||||
return render(request, 'object_list.html',{'object_list':this_logbookentry})
|
return render(request, 'object_list.html',{'object_list':this_logbookentry})
|
||||||
else:
|
else:
|
||||||
|
trips = LogbookEntry.objects.filter(date=date)
|
||||||
|
wallets = set()
|
||||||
|
refwallets = Wallet.objects.filter(survexblock__date=date)
|
||||||
|
for r in refwallets:
|
||||||
|
wallets.add(r)
|
||||||
|
|
||||||
|
allwallets = Wallet.objects.all()
|
||||||
|
# Note that w.year() only works for wallets which have a valid JSON file existing
|
||||||
|
for w in allwallets:
|
||||||
|
if w.date() == date:
|
||||||
|
wallets.add(w)
|
||||||
|
|
||||||
|
thisexpo = this_expedition = Expedition.objects.get(year=int(date[0:4]))
|
||||||
|
if thisexpo:
|
||||||
|
expeditionday = thisexpo.get_expedition_day(date)
|
||||||
|
svxothers = SurvexBlock.objects.filter(expeditionday=expeditionday)
|
||||||
|
else:
|
||||||
|
svxothers = None
|
||||||
|
|
||||||
this_logbookentry=this_logbookentry[0]
|
this_logbookentry=this_logbookentry[0]
|
||||||
return render(request, 'logbookentry.html', {'logbookentry': this_logbookentry})
|
return render(request, 'logbookentry.html',
|
||||||
|
{'logbookentry': this_logbookentry, 'trips': trips, 'svxothers': svxothers, 'wallets': wallets})
|
||||||
else:
|
else:
|
||||||
msg =(f' Logbook entry slug:"{slug}" not found in database on date:"{date}" ')
|
msg =(f' Logbook entry slug:"{slug}" not found in database on date:"{date}" ')
|
||||||
print(msg)
|
print(msg)
|
||||||
|
@ -59,9 +59,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% if newQMlink %}
|
|
||||||
<a href="{{newQMlink}}">Add QM found on this trip</a>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="col1">
|
<div id="col1">
|
||||||
@ -72,4 +69,47 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<span style="font-family: monospace; font-size: 150%; ">
|
||||||
|
|
||||||
|
{% if svxothers %}<u>Survex files</u> on this date:<br>
|
||||||
|
<span style="font-size: 70%; ">
|
||||||
|
{% for item in svxothers %}
|
||||||
|
{% if item.isSurvexBlock %} <a href="/survexfile/{{item.survexfile.path}}">{{item.survexfile.path|safe}}</a><br/>{% endif %}
|
||||||
|
{% empty %}
|
||||||
|
<em>None found for this date.</em><br>
|
||||||
|
{% endfor %}
|
||||||
|
</span>
|
||||||
|
{% else %}
|
||||||
|
<em>No survex files found for this date.</em><br>
|
||||||
|
{% endif %}
|
||||||
|
{% if wallets %}<u>Wallets</u> on this date:<br>
|
||||||
|
<span style="font-size: 70%; ">
|
||||||
|
{% for item in wallets %}
|
||||||
|
<a href="/survey_scans/{{item.walletname|urlencode}}/">{{item.walletname|safe}}</a>
|
||||||
|
{% if item.name %}
|
||||||
|
{{item.name|safe}} <br/>
|
||||||
|
{% else %}
|
||||||
|
{{item.get_fnames|safe}}
|
||||||
|
<br/>
|
||||||
|
{% endif %}
|
||||||
|
{% empty %}
|
||||||
|
<em>None found for this date.</em><br>
|
||||||
|
{% endfor %}
|
||||||
|
</span>
|
||||||
|
{% else %}
|
||||||
|
<em>No wallets files found for this date.</em><br>
|
||||||
|
{% endif %}
|
||||||
|
{% if trips %}<u>All logbook trips</u> on this date:<br>
|
||||||
|
<span style="font-size: 70%; ">
|
||||||
|
{% for item in trips %}
|
||||||
|
{% if item.isLogbookEntry %} <a href="{{item.get_absolute_url}}">{{item.title|safe}}</a><br/>{% endif %}
|
||||||
|
{% empty %}
|
||||||
|
<em>None found for this date, but there should be..</em><br>
|
||||||
|
{% endfor %}
|
||||||
|
</span>
|
||||||
|
{% else %}
|
||||||
|
<em>Hmm...</em><br>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</span>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user