From 0a5e779dfd7e1fb55839e48359fff50c58dc0875 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Fri, 31 Oct 2025 12:00:26 +0200 Subject: [PATCH] fixing many things which are just wrong --- core/views/statistics.py | 16 +++++++++++----- templates/cave.html | 2 +- templates/entrance.html | 2 +- templates/statistics.html | 35 +++++++++++++++++++++-------------- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/core/views/statistics.py b/core/views/statistics.py index 512dd94..f3c5974 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -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) diff --git a/templates/cave.html b/templates/cave.html index 3a13ffe..843ab1f 100644 --- a/templates/cave.html +++ b/templates/cave.html @@ -239,7 +239,7 @@ cave survex path '{{ cave.areacode }}/{% if cave.kataster_number %}{{cave.katast {% if cave.explorers %}

Initially explored by

{{ cave.explorers|safe }}
-

[This is a fossil: it used to show whether the cave was explored by CUCC/expo or by another group, but that information is now available in the survex files recording the surveying, see the primary survex file.] +

[This field is a fossil: it used to show whether the cave was explored by CUCC/expo or by another group, but that information is now available in the survex files recording the surveying, see the primary survex file. However, some caves do not have any survex files, in which case this information is worth keeping.] {% endif %}

{% endif %} diff --git a/templates/entrance.html b/templates/entrance.html index 8794611..493a458 100644 --- a/templates/entrance.html +++ b/templates/entrance.html @@ -76,6 +76,6 @@ {% endif %} {% if entrance.explorers %}

Initially explored by

- {{ entrance.explorers|safe }}
[This is probably outdated fossil data.] + {{ entrance.explorers|safe }}
[This field is probably outdated fossil data.] {% endif %} {% endblock %} diff --git a/templates/statistics.html b/templates/statistics.html index 4e321bd..c60b297 100644 --- a/templates/statistics.html +++ b/templates/statistics.html @@ -1,28 +1,32 @@ {% extends "base.html" %} -{% block title %}Expo statistics{% endblock %} +{% block title %}Expo survey statistics{% endblock %} {% block content %} -

Expedition Statistics

+

Expo Survey Statistics

{{ expoCount }} expeditions: {{ personCount }} people, {{ caveCount }} caves, {{ walletsCount }} wallets and {{ logbookEntryCount }} logbook entries. -

Number of survey legs: {{nsurvexlegs}}
-Total length: {{addupsurvexlength|stringformat:".1f"}} km adding up the total for each year.

+

Number of survey legs: {{adduplegs}}
+Total length: {{adduplength}} km adding up the total for each year.

-

These lengths are from surveys which have been recorded in expo wallets. Non-expo surveys done by other clubs, and surveys -which have not been properly recorded -in an expo wallet are excluded. -

These are uncorrected tape lengths which include pitches and duplicates but exclude splays or surface-surveys. They are uncorrected -because they are lengths before any loop-closure corrections done by survex. -

This only includes lengths surveyed by expo survey trips (though not all have valid expo-attendees as some survex files are administrative collections of *include statements). This no longer (since 30 June 2025) includes non-expo surveys (ARGE and others). +

These lengths are not authoritative. +

These are uncorrected tape lengths.They are uncorrected +because they are lengths before any loop-closure corrections done by survex and because they include duplicated surveys. These numbers include pitches but exclude splays or surface-surveys. -

Authoritative survey lengths for each cave are calculated using a script which uses the -loop-closure corrected lengths and is manually curated to exclude duplicate surveys of the same cave. The results are maintained +

Authoritative survey lengths for each cave, as explored by expo participants, are calculated using a script which +

  1. uses the +loop-closure corrected lengths +
  2. is manually curated to exclude duplicate surveys of the same cave, +
  3. and to include only surveys by expo participants. +
+ +These authoritative results are maintained in an ODS-format spreadsheet. +

- + {% for legs in legsbyexpo %} @@ -30,6 +34,7 @@ in an ODS-format spr + {% endfor %} @@ -37,7 +42,9 @@ in an ODS-format spr

One Survex Survey Block is one *begin/*end block of data in a survex file. Some files from other caving clubs may have a convention of using many more blocks per file than we do, e.g. if the file is exported from other software into survex format, but each block is recorded on a single day. -

Currently the number of cavers includes non-caving attendees: that needs to be fixed. +

The number of cavers excludes those attending who were not caving. This is something of a distortion as non-cavers +may still be doing useful expo-related work such as prospecting, ferrying gear and preparing food. +Non-cavers also include the bier tent and Rover Richardson, see the folk list for details.

YearSurvex
Survey
Blocks
Survex
Survey Legs
Survex
length(m)
Caversmeters/caver
YearSurvex
Survey
Blocks
Survex
Survey Legs
Survex
length(m)
CaversNon-caversmeters/caver
{{legs.0}}{{legs.1.nsurvexlegs|rjust:"10"|floatformat:"0g"}} {{legs.1.survexleglength|floatformat:"0g"}} {{legs.1.people|floatformat:"0g"}}{{legs.1.tourists|floatformat:"0g"}} {{legs.1.success|floatformat:"1g"}}