summaryrefslogtreecommitdiffstats
path: root/core/views/statistics.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-04-18 23:33:04 +0300
committerPhilip Sargent <philip.sargent@klebos.com>2022-04-18 23:33:04 +0300
commitc9931fd45eaa0b05d1bce37d471e873b0955c125 (patch)
tree05e48cee33c217dbd47786961512f534f88b8177 /core/views/statistics.py
parent3813b21dcf5fbec27f5a5d05deca5d302d4e1637 (diff)
downloadtroggle-c9931fd45eaa0b05d1bce37d471e873b0955c125.tar.gz
troggle-c9931fd45eaa0b05d1bce37d471e873b0955c125.tar.bz2
troggle-c9931fd45eaa0b05d1bce37d471e873b0955c125.zip
survey legs calc fixed
Diffstat (limited to 'core/views/statistics.py')
-rw-r--r--core/views/statistics.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/views/statistics.py b/core/views/statistics.py
index 02cbd43..9e7ff81 100644
--- a/core/views/statistics.py
+++ b/core/views/statistics.py
@@ -130,22 +130,21 @@ def stats(request):
legsbyexpo = [ ]
addupsurvexlength = 0
+ addupsurvexlegs = 0
for expedition in Expedition.objects.all():
survexblocks = expedition.survexblock_set.all()
legsyear=0
survexleglength = 0.0
for survexblock in survexblocks:
survexleglength += survexblock.legslength
- try:
- legsyear += int(survexblock.legsall)
- except:
- pass
+ legsyear += int(survexblock.legsall)
addupsurvexlength += survexleglength
+ addupsurvexlegs += legsyear
legsbyexpo.append((expedition, {"nsurvexlegs": "{:,}".format(legsyear),
"survexleglength":"{:,.0f}".format(survexleglength)}))
legsbyexpo.reverse()
- renderDict = {**statsDict, **{ "addupsurvexlength":addupsurvexlength/1000, "legsbyexpo":legsbyexpo }} # new syntax
+ renderDict = {**statsDict, **{ "addupsurvexlength":addupsurvexlength/1000, "legsbyexpo":legsbyexpo, "nsurvexlegs":addupsurvexlegs }} # new syntax
return render(request,'statistics.html', renderDict)
def dataissues(request):