mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
logbook trips, and some wallets working.
This commit is contained in:
parent
6387de038b
commit
154722f765
@ -296,6 +296,7 @@ def svx(request, survex_file):
|
|||||||
svxincludes = re.findall(r"(?i)\*include\s+(\S+)", form.data["code"] or "")
|
svxincludes = re.findall(r"(?i)\*include\s+(\S+)", form.data["code"] or "")
|
||||||
|
|
||||||
svxfile = form.survexfile # only valid once form.GetDiscCode() called
|
svxfile = form.survexfile # only valid once form.GetDiscCode() called
|
||||||
|
print(f"{svxfile=}")
|
||||||
try:
|
try:
|
||||||
svxblocksall = svxfile.survexblock_set.all()
|
svxblocksall = svxfile.survexblock_set.all()
|
||||||
except AttributeError: # some survexfiles just *include files and have no blocks themselves
|
except AttributeError: # some survexfiles just *include files and have no blocks themselves
|
||||||
@ -304,13 +305,14 @@ def svx(request, survex_file):
|
|||||||
for b in svxblocksall:
|
for b in svxblocksall:
|
||||||
if b.date:
|
if b.date:
|
||||||
svxblocks.append(b)
|
svxblocks.append(b)
|
||||||
print(f"{svxfile=} {svxblocks}")
|
print(f"- {b}")
|
||||||
|
|
||||||
# collect all the stuff that happens on the same dates as the survex blocks
|
# collect all the stuff that happens on the same dates as the survex blocks
|
||||||
|
|
||||||
dates = set()
|
dates = set()
|
||||||
for b in svxblocks:
|
for b in svxblocks:
|
||||||
dates.add(b.date)
|
dates.add(b.date)
|
||||||
|
print(f"- {b.date}")
|
||||||
events = events_on_dates(dates)
|
events = events_on_dates(dates)
|
||||||
|
|
||||||
vmap = {
|
vmap = {
|
||||||
@ -323,6 +325,7 @@ def svx(request, survex_file):
|
|||||||
"difflist": difflist,
|
"difflist": difflist,
|
||||||
"logmessage": logmessage,
|
"logmessage": logmessage,
|
||||||
"form": form,
|
"form": form,
|
||||||
|
"events": events,
|
||||||
}
|
}
|
||||||
# vmap.update(csrf(request)) # this now refreshes to the wrong value, now that we user render(request,
|
# vmap.update(csrf(request)) # this now refreshes to the wrong value, now that we user render(request,
|
||||||
|
|
||||||
@ -337,7 +340,6 @@ def events_on_dates(dates):
|
|||||||
"""Returns a dictionary of indexed by date. For each date there is a named tuple of 3 lists:
|
"""Returns a dictionary of indexed by date. For each date there is a named tuple of 3 lists:
|
||||||
logbookentries, survexfiles (NB files, not blocks), and wallets.
|
logbookentries, survexfiles (NB files, not blocks), and wallets.
|
||||||
"""
|
"""
|
||||||
print(dates)
|
|
||||||
events = {}
|
events = {}
|
||||||
for d in dates:
|
for d in dates:
|
||||||
trips = LogbookEntry.objects.filter(date=d)
|
trips = LogbookEntry.objects.filter(date=d)
|
||||||
@ -350,6 +352,7 @@ def events_on_dates(dates):
|
|||||||
refwallets = allwallets.filter(survexblock__date=d)
|
refwallets = allwallets.filter(survexblock__date=d)
|
||||||
|
|
||||||
events[d] = SameDateEvents(trips=trips, svxfiles=svxfiles, wallets=refwallets)
|
events[d] = SameDateEvents(trips=trips, svxfiles=svxfiles, wallets=refwallets)
|
||||||
|
print(events)
|
||||||
return events
|
return events
|
||||||
|
|
||||||
# The cavern running function. This is NOT where it is run inside the form! see SvxForm.Process() for that
|
# The cavern running function. This is NOT where it is run inside the form! see SvxForm.Process() for that
|
||||||
|
@ -82,16 +82,20 @@ LOGMESSAGES
|
|||||||
</div>
|
</div>
|
||||||
<span style="font-family: monospace; font-size: 130%; ">
|
<span style="font-family: monospace; font-size: 130%; ">
|
||||||
{% for sb in svxblocks %}
|
{% for sb in svxblocks %}
|
||||||
<details {% if forloop.first %} open{% endif %}>
|
|
||||||
<summary><b><a href="/expedition/{{sb.date|date:"Y"}}">{{sb.date|date:"Y"}}</a>{{sb.date|date:"-m-d"}}</b> {{sb.title}} '{{sb.name}}'</summary>
|
|
||||||
List of Logbook entries, wallets and other survex files on {{sb.date|date:"Y-m-d"}}.
|
|
||||||
<br />
|
|
||||||
[Work in progress, Feb. 2023...]<br />
|
|
||||||
{% include 'onthisdate.html' %}
|
|
||||||
</details>
|
|
||||||
{% empty %}
|
{% empty %}
|
||||||
Cannot find any survex blocks in this survex file. <br />
|
Cannot find any survex blocks in this survex file (not looking at *include files). <br />
|
||||||
Report this to a nerd if you think this is incorrect.
|
Report this to a nerd if you think this is incorrect.
|
||||||
|
<hr />
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% for key, value in events.items %}
|
||||||
|
<details {% if forloop.first %} open{% endif %}>
|
||||||
|
<summary><b><a href="/expedition/{{key|date:"Y"}}">{{key|date:"Y"}}</a>{{key|date:"-m-d"}}</b> </summary>
|
||||||
|
<br />
|
||||||
|
{% with trips=value.0 svxfiles=value.1 wallets=value.2 %}
|
||||||
|
{% include 'onthisdate.html' %}
|
||||||
|
{% endwith %}
|
||||||
|
</details>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</span>
|
</span>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user