diff options
Diffstat (limited to 'core/views/statistics.py')
-rw-r--r-- | core/views/statistics.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/core/views/statistics.py b/core/views/statistics.py index 5231b31..f56b821 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -15,7 +15,50 @@ from troggle.parsers.people import GetPersonExpeditionNameLookup, foreign_friend the status of data inconsistencies """ +def svxfilewild(request, year=None): + """Looks for survexfiles which do not have an associated + wallet, per year + """ + 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 + survexleglength = 0.0 + for survexblock in survexblocks: + survexleglength += survexblock.legslength + legsyear += int(survexblock.legsall) + addupsurvexlength += survexleglength + addupsurvexlegs += legsyear + legsbyexpo.append((expedition, {"nsurvexlegs": legsyear, "survexleglength": survexleglength})) + legsbyexpo.reverse() + svxwild = [] + for expedition in expos: + survexblocks = expedition.survexblock_set.all() + for sb in survexblocks: + # print(f"{sb=}") + if sb.scanswallet == None: + if sb.name != "rootblock": + svxwild.append(sb) + print(f" WILD {sb.survexfile} {sb.date}") + # else: + # print(f" TAME {sb.survexfile}") + + return render(request, "survexfilewild.html", + {"addupsurvexlength": addupsurvexlength / 1000, + "legsbyexpo": legsbyexpo, + "nsurvexlegs": addupsurvexlegs, + "svxwild": svxwild} + ) + def therionissues(request): """Page displaying contents of a file produced during data import""" logname = "therionrefs.log" |