2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-17 07:17:14 +00:00

auto new year stuff

This commit is contained in:
2024-03-15 01:50:34 +00:00
parent e1eb85969a
commit d970942f04
7 changed files with 68 additions and 40 deletions

View File

@@ -20,7 +20,7 @@ from troggle.core.models.logbooks import LogbookEntry
from troggle.core.models.caves import Cave, GetCaveLookup
from troggle.core.models.survex import SurvexFile, SurvexBlock #, SurvexDirectory
from troggle.core.models.wallets import Wallet
from troggle.core.utils import only_commit
from troggle.core.utils import only_commit, current_expo
from troggle.parsers.survex import parse_one_file
"""Everything that views survexfiles
@@ -389,6 +389,7 @@ def svx(request, survex_file):
events = events_on_dates(svxblocks)
vmap = {
"year": current_expo(),
"settings": settings,
"warning": warning,
"has_3d": has_3d,
@@ -640,7 +641,8 @@ def survexcaveslist(request):
"settings": settings,
"onefilecaves": onefilecaves,
"multifilecaves": multifilecaves,
"subdircaves": subdircaves,
"subdircaves": subdircaves,
"year": current_expo(),
},
)
@@ -654,7 +656,7 @@ def survexdir(request):
f.pathbad = True
if Path(settings.SURVEX_DATA, f"{f.path}.svx").is_file():
f.pathbad = False
return render(request, "survexdir.html", {"survexfiles": survexfiles, "caves": caves})
return render(request, "survexdir.html", {"survexfiles": survexfiles, "caves": caves, "year": current_expo()})
def get_primaries(cave):
sds = []
@@ -674,7 +676,7 @@ def survexcavesingle(request, cave_shortname):
cave = Gcavelookup[cave_shortname]
# print(f"survexcavesingle {cave_shortname=} => {cave=}")
cave.sds = get_primaries(cave)
return render(request, "svxcaves.html", {"settings": settings, "caves": [cave]})
return render(request, "svxcaves.html", {"settings": settings, "caves": [cave], "year": current_expo()})
else:
caves = Cave.objects.filter(kataster_number=cave_shortname)
if len(caves) > 0:
@@ -682,9 +684,9 @@ def survexcavesingle(request, cave_shortname):
for cave in caves:
cave.sds = get_primaries(cave)
# print(f"many {cave=} => {cave.sds=}")
return render(request, "svxcaves.html", {"settings": settings, "caves": caves})
return render(request, "svxcaves.html", {"settings": settings, "caves": caves, "year": current_expo()})
else:
return render(request, "errors/svxcaves404.html", {"settings": settings, "cave": cave_shortname})
return render(request, "errors/svxcaves404.html", {"settings": settings, "cave": cave_shortname, "year": current_expo()})
def check_cave_registered(areacode, survex_cave):
"""Checks whether a cave has been properly registered when it is found in the Loser repo