summaryrefslogtreecommitdiffstats
path: root/core/views/survex.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2024-03-15 16:37:30 +0000
committerPhilip Sargent <philip.sargent@gmail.com>2024-03-15 16:37:30 +0000
commita0ef426cdbb5da3e6d005d03e5caaa88f1c6cf7c (patch)
treeeba474c52c04849b4d15081b6461e17b4c87f58f /core/views/survex.py
parent5dfaa893add978e72a2a0ec38ba7664cfbbe668c (diff)
downloadtroggle-a0ef426cdbb5da3e6d005d03e5caaa88f1c6cf7c.tar.gz
troggle-a0ef426cdbb5da3e6d005d03e5caaa88f1c6cf7c.tar.bz2
troggle-a0ef426cdbb5da3e6d005d03e5caaa88f1c6cf7c.zip
fix year in menu for older survexfiles
Diffstat (limited to 'core/views/survex.py')
-rw-r--r--core/views/survex.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/views/survex.py b/core/views/survex.py
index b24b51b..c51a2c5 100644
--- a/core/views/survex.py
+++ b/core/views/survex.py
@@ -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.