2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 23:01:52 +00:00

fix year in menu for older survexfiles

This commit is contained in:
Philip Sargent 2024-03-15 16:37:30 +00:00
parent 5dfaa893ad
commit a0ef426cdb

View File

@ -387,9 +387,9 @@ def svx(request, survex_file):
events = events_on_dates(svxblocks)
year = year_for_svx(svxblocks)
vmap = {
"year": current_expo(),
"year": year,
"settings": settings,
"warning": warning,
"has_3d": has_3d,
@ -411,6 +411,16 @@ def svx(request, survex_file):
SameDateEvents = namedtuple('SameDateEvents', ['trips', 'svxfiles', 'wallets', 'blocks'])
def year_for_svx(svxblocks):
y = settings.EPOCH
for b in svxblocks:
if b.date:
if b.date > y:
y = b.date
return str(y.year)
def events_on_dates(svxblocks):
"""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.