From 12aa6ced869a442e757616e41abde32eee9ea0b8 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sat, 5 Aug 2023 14:15:35 +0300 Subject: [PATCH] length of unreference cave survey added --- core/views/statistics.py | 19 ++++++++++++++----- templates/base.html | 13 ++++++------- templates/controlPanel.html | 5 +++-- templates/survexfilewild.html | 4 ++++ 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/core/views/statistics.py b/core/views/statistics.py index a820c00..d18ca57 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -8,6 +8,7 @@ from troggle.core.models.caves import Cave, Entrance from troggle.core.models.logbooks import LogbookEntry from troggle.core.models.survex import SurvexStation, SurvexPersonRole from troggle.core.models.troggle import DataIssue, Expedition, Person, PersonExpedition +from troggle.core.models.wallets import Wallet from troggle.parsers.people import GetPersonExpeditionNameLookup, foreign_friends # from django.views.generic.list import ListView @@ -22,12 +23,12 @@ def svxfilewild(request, year=None): legsbyexpo = [] addupsurvexlength = 0.0 addupsurvexlegs = 0 - + if not year: expos = Expedition.objects.all() else: expos = Expedition.objects.filter(year=year) - + for expedition in expos: survexblocks = expedition.survexblock_set.all() legsyear = 0 @@ -41,6 +42,7 @@ def svxfilewild(request, year=None): legsbyexpo.reverse() svxwild = [] + wildlength = 0.0 for expedition in expos: survexblocks = expedition.survexblock_set.all() for sb in survexblocks: @@ -49,19 +51,26 @@ def svxfilewild(request, year=None): if sb.name != "rootblock": svxwild.append(sb) print(f" WILD {sb.survexfile} {sb.date}") + wildlength += sb.legslength sb.year = f"{expedition}" people = SurvexPersonRole.objects.filter(survexblock=sb) team = [] for p in people: team.append(p.personname) sb.team = team - # else: - # print(f" TAME {sb.survexfile}") - + walletslength = 0.0 + if year: + wallets = Wallet.objects.filter(walletyear__year=year) + for w in wallets: + for sb in w.survexblock_set.all(): + walletslength += sb.legslength + return render(request, "survexfilewild.html", {"addupsurvexlength": addupsurvexlength / 1000, "legsbyexpo": legsbyexpo, "nsurvexlegs": addupsurvexlegs, + "walletslength": walletslength, + "wildlength": wildlength, "svxwild": svxwild} ) diff --git a/templates/base.html b/templates/base.html index 3fbe04f..46f29b2 100644 --- a/templates/base.html +++ b/templates/base.html @@ -31,9 +31,10 @@ {% else %}