2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

wild survex file report

This commit is contained in:
Philip Sargent 2023-08-05 12:43:06 +03:00
parent b709dd2f1b
commit 7df2d44748
3 changed files with 90 additions and 0 deletions

View File

@ -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"

View File

@ -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 %}

View File

@ -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