summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-08-05 14:15:35 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-08-05 14:15:35 +0300
commit12aa6ced869a442e757616e41abde32eee9ea0b8 (patch)
tree910693fa9aa239e3483b3f6d84e278f9a0168abf /core
parentee5a2c9ef84f5d8fa45652763f532d4db371364c (diff)
downloadtroggle-12aa6ced869a442e757616e41abde32eee9ea0b8.tar.gz
troggle-12aa6ced869a442e757616e41abde32eee9ea0b8.tar.bz2
troggle-12aa6ced869a442e757616e41abde32eee9ea0b8.zip
length of unreference cave survey added
Diffstat (limited to 'core')
-rw-r--r--core/views/statistics.py19
1 files changed, 14 insertions, 5 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}
)