From 35e9eb558d0ef7fb34d8ed7140a684cdce0998cf Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 12 Mar 2023 01:09:17 +0000 Subject: [PATCH] Identified survey length discrepencies --- core/views/scans.py | 5 +++++ core/views/statistics.py | 7 +++++-- core/views/survex.py | 2 +- templates/statistics.html | 10 +++++----- templates/svxfile.html | 2 +- templates/yearwallets.html | 1 + 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/core/views/scans.py b/core/views/scans.py index 0e49a8c..7f9d8c7 100644 --- a/core/views/scans.py +++ b/core/views/scans.py @@ -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, }, ) diff --git a/core/views/statistics.py b/core/views/statistics.py index b7af823..8392f64 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -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 = { diff --git a/core/views/survex.py b/core/views/survex.py index edc3b1f..2a750aa 100644 --- a/core/views/survex.py +++ b/core/views/survex.py @@ -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: diff --git a/templates/statistics.html b/templates/statistics.html index 9439fdc..f3cb0b7 100644 --- a/templates/statistics.html +++ b/templates/statistics.html @@ -12,18 +12,18 @@ Total length: {{addupsurvexlength|stringformat:".1f"}} km adding up the total fo

These are uncorrected tape lengths which include pitches and duplicates but exclude splays or surface-surveys.

-This is work in progress (March 2023): the last column is floatng point numbers, the 3rd column appears to be strings.. +This is work in progress (March 2023): the underground survey length does not match that in e.g. +wallets for 2018 probably because ARGE surveys are not in any of our wallets.

This includes ARGE and other surveys currently. It will be changed to only include lengths surveyed by valid Expo-attendees. - + {% for legs in legsbyexpo %} - - - + + {% endfor %}
YearSurvex
Survey
Blocks
Survex
Survey Legs
Total length
(m)
Total length
(m)
YearSurvex
Survey
Blocks
Survex
Survey Legs
Survex
length(m)
{{legs.0}} {{legs.0.survexblock_set.all|length}}{{legs.1.nsurvexlegs|rjust:"10"}} {{legs.1.survexleglength}}{{legs.1.survexleglength|floatformat:0}}{{legs.1.nsurvexlegs|rjust:"10"|floatformat:"0g"}} {{legs.1.survexleglength|floatformat:"0g"}}
diff --git a/templates/svxfile.html b/templates/svxfile.html index ca35cde..ccd9749 100644 --- a/templates/svxfile.html +++ b/templates/svxfile.html @@ -80,7 +80,7 @@ LOGMESSAGES --> {% endif %} -survey length: {{svxlength|floatformat:2}} metres +undergound survey length: {{svxlength|floatformat:2}} metres {% for sb in svxblocks %} {% empty %} diff --git a/templates/yearwallets.html b/templates/yearwallets.html index 242f1fc..718d621 100644 --- a/templates/yearwallets.html +++ b/templates/yearwallets.html @@ -29,6 +29,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c {% include 'wallet_table.html' %}

Note that names in italics are copied from the related survex file block name. +

Total underground survey length: {{length_ug|floatformat:"1g"}} m
WalletWallet DateWallet NamePeopleCaveScansSurvex blocksDrawings using these scans