forked from expo/troggle
Identified survey length discrepencies
This commit is contained in:
@@ -195,6 +195,10 @@ def walletslistyear(request, year):
|
||||
manywallets = ticksyearwallet(year)
|
||||
expeditions = Expedition.objects.all() #bad Django style
|
||||
expedition = expeditions.filter(year=year)
|
||||
length_ug = 0.0
|
||||
for w in manywallets:
|
||||
for sb in w.survexblock_set.all():
|
||||
length_ug += sb.legslength
|
||||
print("--")
|
||||
return render(
|
||||
request,
|
||||
@@ -205,6 +209,7 @@ def walletslistyear(request, year):
|
||||
"year": year,
|
||||
"expeditions": expeditions,
|
||||
"expedition": expedition,
|
||||
"length_ug": length_ug,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -166,6 +166,9 @@ def pathsreport(request):
|
||||
|
||||
|
||||
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.
|
||||
"""
|
||||
statsDict = {}
|
||||
statsDict["expoCount"] = f"{Expedition.objects.count():,}"
|
||||
statsDict["caveCount"] = f"{Cave.objects.count():,}"
|
||||
@@ -173,7 +176,7 @@ def stats(request):
|
||||
statsDict["logbookEntryCount"] = f"{LogbookEntry.objects.count():,}"
|
||||
|
||||
legsbyexpo = []
|
||||
addupsurvexlength = 0
|
||||
addupsurvexlength = 0.0
|
||||
addupsurvexlegs = 0
|
||||
for expedition in Expedition.objects.all():
|
||||
survexblocks = expedition.survexblock_set.all()
|
||||
@@ -184,7 +187,7 @@ def stats(request):
|
||||
legsyear += int(survexblock.legsall)
|
||||
addupsurvexlength += survexleglength
|
||||
addupsurvexlegs += legsyear
|
||||
legsbyexpo.append((expedition, {"nsurvexlegs": f"{legsyear:,}", "survexleglength": f"{survexleglength:,.0f}"}))
|
||||
legsbyexpo.append((expedition, {"nsurvexlegs": legsyear, "survexleglength": survexleglength}))
|
||||
legsbyexpo.reverse()
|
||||
|
||||
renderDict = {
|
||||
|
||||
@@ -353,7 +353,7 @@ def svx(request, survex_file):
|
||||
svxlength = 0.0
|
||||
for b in svxblocksall:
|
||||
svxlength += b.legslength
|
||||
print(svxlength,b)
|
||||
print(svxlength,b, b.legsall)
|
||||
except AttributeError: # some survexfiles just *include files and have no blocks themselves
|
||||
svxblocksall = []
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user