mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-02-08 16:24:14 +00:00
fixing many things which are just wrong
This commit is contained in:
@@ -18,6 +18,9 @@ from troggle.parsers.people import GetPersonExpeditionNameLookup, foreign_friend
|
||||
the status of data inconsistencies. Also the wallets summary report.
|
||||
"""
|
||||
def legs_by_expo(expos):
|
||||
"""This depends rather deeply on precisely how the survex parser has selected what it records
|
||||
from each survex file
|
||||
"""
|
||||
legsbyexpo = []
|
||||
addupsurvexlength = 0.0
|
||||
addupsurvexlegs = 0
|
||||
@@ -33,12 +36,13 @@ def legs_by_expo(expos):
|
||||
addupsurvexlength += survexleglength
|
||||
addupsurvexlegs += legsyear
|
||||
|
||||
expoers = PersonExpedition.objects.filter(expedition=expedition).count()
|
||||
expoers = PersonExpedition.objects.filter(expedition=expedition, noncaver=False).count()
|
||||
if expoers > 0:
|
||||
success = survexleglength/expoers
|
||||
else:
|
||||
success = ""
|
||||
legsbyexpo.append((expedition, {"success":success, "people": expoers, "nsurvexlegs": legsyear, "survexleglength": survexleglength}))
|
||||
tourists = PersonExpedition.objects.filter(expedition=expedition, noncaver=True).count()
|
||||
legsbyexpo.append((expedition, {"success":success, "people": expoers, "tourists": tourists, "nsurvexlegs": legsyear, "survexleglength": survexleglength}))
|
||||
legsbyexpo.reverse()
|
||||
return legsbyexpo, addupsurvexlegs, addupsurvexlength
|
||||
|
||||
@@ -111,7 +115,7 @@ def svxfilewild(request, year=None):
|
||||
|
||||
def stats(request):
|
||||
"""Calculates number of survey blocks, the number of survey legs and the survey length for each year.
|
||||
This is only underground survey legs, but includes ARGE as well as Expo survex files.
|
||||
This is only underground survey legs, but includes "wild" as well as walleted survex files.
|
||||
"""
|
||||
statsDict = {}
|
||||
statsDict["caveCount"] = f"{Cave.objects.count():,}"
|
||||
@@ -121,14 +125,16 @@ def stats(request):
|
||||
|
||||
#statsDict["expoCount"] = f"{Expedition.objects.count():,}" # incorrect as no expo in 76, 2020,21
|
||||
n = int(current_expo()) - 1975 - 3
|
||||
statsDict["expoCount"] = f"{n:,}" # incorrect as no expo in 76, 2020,21
|
||||
statsDict["expoCount"] = f"{n:,}"
|
||||
|
||||
expos = Expedition.objects.all()
|
||||
legsbyexpo, addupsurvexlegs, addupsurvexlength = legs_by_expo(expos)
|
||||
adduplength = f"{addupsurvexlength/1000:.1f}"
|
||||
adduplegs = f"{addupsurvexlegs:,}"
|
||||
|
||||
renderDict = {
|
||||
**statsDict,
|
||||
**{"addupsurvexlength": addupsurvexlength / 1000, "legsbyexpo": legsbyexpo, "nsurvexlegs": addupsurvexlegs, "year": current_expo()},
|
||||
**{"adduplength": adduplength, "legsbyexpo": legsbyexpo, "adduplegs": adduplegs, "year": current_expo()},
|
||||
} # new syntax
|
||||
return render(request, "statistics.html", renderDict)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user