summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/views/statistics.py43
-rw-r--r--templates/survexfilewild.html44
-rw-r--r--urls.py3
3 files changed, 90 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"
diff --git a/templates/survexfilewild.html b/templates/survexfilewild.html
new file mode 100644
index 0000000..36cfbc3
--- /dev/null
+++ b/templates/survexfilewild.html
@@ -0,0 +1,44 @@
+{% extends "base.html" %}
+{% block title %}Survex files which have no wallets{% endblock %}
+
+{% block content %}
+
+<h1>'Wild' Survex files</h1>
+
+<p>These are survex files which have NO ATTACHED WALLET.
+<br />
+i.e. they have no *REF line which refers to the wallet holding the raw data for this survey.
+<p>WORK IN PROGRESS
+
+<table>
+<tr><th>Survex Blocks</th><th>date</th><th>survex file</th><th>surveyed length</th></tr>
+{% for sb in svxwild %}
+<tr>
+ <td style="text-align:center"> {{ sb }} </td>
+ <td style="text-align:center"> {{sb.date }} </td>
+ <td style="text-align:left"> <a href="{% url "svx" sb.survexfile.path %}">{{sb.survexfile.path}}</a> </td>
+ <td style="text-align:center"> {{sb.legslength|floatformat:"1g" }}m </td>
+</tr>
+{% endfor %}
+</table>
+<br />
+<br />
+<table>
+<tr><th>Year</th><th>Survex<br>Survey<br>Blocks</th><th>Survex<br>Survey Legs</th><th>Survex <br>length(m)</th></tr>
+{% for legs in legsbyexpo %}
+<tr>
+ <td style="text-align:center"><a href="{{ legs.0.get_absolute_url }}">{{legs.0}}</a></td>
+ <td style="text-align:center">{{legs.0.survexblock_set.all|length}}</td>
+ <td style="text-align:center">{{legs.1.nsurvexlegs|rjust:"10"|floatformat:"0g"}} </td>
+ <td style="text-align:right">{{legs.1.survexleglength|floatformat:"0g"}}</td>
+</tr>
+{% endfor %}
+</table>
+
+
+<p>These are uncorrected tape lengths which include pitches and duplicates but exclude splays or surface-surveys.
+<p>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.
+
+{% endblock %} \ No newline at end of file
diff --git a/urls.py b/urls.py
index 2e13eb8..312df49 100644
--- a/urls.py
+++ b/urls.py
@@ -192,6 +192,9 @@ trogglepatterns = [
path('survexfile/<path:survex_file>.err', survex.err, name="err"),
path('survexfile/<path:survex_cave>', survex.survexcavesingle, name="survexcavessingle"),
+ path('survexfilewild', statistics.svxfilewild, name="svxfilewild"),
+ path('survexfilewild/<int:year>', statistics.svxfilewild, name="svxfilewild"),
+
# The survey scans in the wallets. This short-cuts SCANS_URL which is not used anymore and is defunct
path('survey_scans/', allscans, name="allscans"), # all the scans in all wallets