mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-16 17:37:06 +00:00
logbook trips, and some wallets working.
This commit is contained in:
@@ -296,6 +296,7 @@ def svx(request, survex_file):
|
||||
svxincludes = re.findall(r"(?i)\*include\s+(\S+)", form.data["code"] or "")
|
||||
|
||||
svxfile = form.survexfile # only valid once form.GetDiscCode() called
|
||||
print(f"{svxfile=}")
|
||||
try:
|
||||
svxblocksall = svxfile.survexblock_set.all()
|
||||
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:
|
||||
if b.date:
|
||||
svxblocks.append(b)
|
||||
print(f"{svxfile=} {svxblocks}")
|
||||
print(f"- {b}")
|
||||
|
||||
# collect all the stuff that happens on the same dates as the survex blocks
|
||||
|
||||
dates = set()
|
||||
for b in svxblocks:
|
||||
dates.add(b.date)
|
||||
print(f"- {b.date}")
|
||||
events = events_on_dates(dates)
|
||||
|
||||
vmap = {
|
||||
@@ -323,6 +325,7 @@ def svx(request, survex_file):
|
||||
"difflist": difflist,
|
||||
"logmessage": logmessage,
|
||||
"form": form,
|
||||
"events": events,
|
||||
}
|
||||
# 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:
|
||||
logbookentries, survexfiles (NB files, not blocks), and wallets.
|
||||
"""
|
||||
print(dates)
|
||||
events = {}
|
||||
for d in dates:
|
||||
trips = LogbookEntry.objects.filter(date=d)
|
||||
@@ -350,6 +352,7 @@ def events_on_dates(dates):
|
||||
refwallets = allwallets.filter(survexblock__date=d)
|
||||
|
||||
events[d] = SameDateEvents(trips=trips, svxfiles=svxfiles, wallets=refwallets)
|
||||
print(events)
|
||||
return events
|
||||
|
||||
# The cavern running function. This is NOT where it is run inside the form! see SvxForm.Process() for that
|
||||
|
||||
Reference in New Issue
Block a user