2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 12:51:11 +00:00

fix bug and make table better

This commit is contained in:
2025-10-22 23:12:11 +03:00
parent ac50d28d36
commit 43b3d712a7
4 changed files with 20 additions and 10 deletions

View File

@@ -150,6 +150,8 @@ def controlpanel(request):
def folk_export(request): def folk_export(request):
"""Recreates the folk.csv file from the database contents """Recreates the folk.csv file from the database contents
WORK IN PROGRESS JULY 2025 WORK IN PROGRESS JULY 2025
THIS DOES NOT CHECK IN THE FILE with git
""" """
def deslugify(slug): def deslugify(slug):
deslug = slug.replace("-"," ",1).title() deslug = slug.replace("-"," ",1).title()

View File

@@ -54,11 +54,11 @@ def legs_and_lengths(expos):
if sb.scanswallet == None: if sb.scanswallet == None:
if sb.foreigners: if sb.foreigners:
svxforeign.append(sb) svxforeign.append(sb)
print(f" FOREIGN {sb.survexfile} {sb.date}") # print(f" FOREIGN {sb.survexfile} {sb.date}")
foreignlength += sb.legslength foreignlength += sb.legslength
elif sb.name != "rootblock": elif sb.name != "rootblock":
svxwild.append(sb) svxwild.append(sb)
print(f" WILD {sb.survexfile} {sb.date}") # print(f" WILD {sb.survexfile} {sb.date}")
wildlength += sb.legslength wildlength += sb.legslength
sb.year = f"{expedition}" sb.year = f"{expedition}"
people = SurvexPersonRole.objects.filter(survexblock=sb) people = SurvexPersonRole.objects.filter(survexblock=sb)
@@ -71,8 +71,12 @@ def legs_and_lengths(expos):
def svxfilewild(request, year=None): def svxfilewild(request, year=None):
"""Looks for survexfiles which do not have an associated """Looks for survexfiles which do not have an associated
wallet, per year. This should not be in this file, but with the other wallets reports. wallet, per year. This should not be in this file, but with the other wallets reports.
Note that the detection of non-cucc expo is done in parsers/survex.py by
rx_commteam = re.compile(r"(?i)\s*(Messteam|Zeichner|Gerätefehler|LUSS Dead Mountains)\s*[:]?(.*)")
""" """
non_cucc_signifiers = '"; Messteam", "; Zeichner", "; Gerätefehler:" or "; "LUSS Dead Mountains"'
if not year: if not year:
expos = Expedition.objects.all() expos = Expedition.objects.all()
@@ -100,6 +104,7 @@ def svxfilewild(request, year=None):
"foreignlength": foreignlength, "foreignlength": foreignlength,
"year":year, "year":year,
"expeditions": Expedition.objects.all(), "expeditions": Expedition.objects.all(),
"non_cucc_signifiers": non_cucc_signifiers,
"svxwild": svxwild, "svxwild": svxwild,
"svxforeign": svxforeign} "svxforeign": svxforeign}
) )

View File

@@ -400,6 +400,7 @@ def svx(request, survex_file):
form.data["code"] = rcode form.data["code"] = rcode
# GET, also fall-through after POST-specific handling # GET, also fall-through after POST-specific handling
if svxfile := get_survexfile(survex_file): if svxfile := get_survexfile(survex_file):
print(f"svx(): a real SurvexFile object {svxfile=} {svxfile.id=}") print(f"svx(): a real SurvexFile object {svxfile=} {svxfile.id=}")
@@ -749,7 +750,7 @@ def survexcavesingle(request, cave_shortname):
"""parsing all the survex files of a single cave and showing that it's consistent and can find all """parsing all the survex files of a single cave and showing that it's consistent and can find all
the files and people. the files and people.
But might also be a link to a single survex file with no ".svx" suffix But might also be a link to a single survex file with no ".svx" suffix, which may not be a cave.
""" """
if cave_shortname.startswith("caves-16"): if cave_shortname.startswith("caves-16"):
return svx(request, cave_shortname) return svx(request, cave_shortname)
@@ -769,7 +770,9 @@ def survexcavesingle(request, cave_shortname):
# print(f"many {cave=} => {cave.sds=}") # print(f"many {cave=} => {cave.sds=}")
return render(request, "svxcaves.html", {"settings": settings, "caves": caves, "year": current_expo()}) return render(request, "svxcaves.html", {"settings": settings, "caves": caves, "year": current_expo()})
else: else:
return render(request, "errors/svxcaves404.html", {"settings": settings, "cave": cave_shortname, "year": current_expo()}) # survex file not a cave, e.g. surface/1623/allsurface.svx
return svx(request, cave_shortname)
# return render(request, "errors/svxcaves404.html", {"settings": settings, "cave": cave_shortname, "year": current_expo()})
def check_cave_registered(areacode, survex_cave): def check_cave_registered(areacode, survex_cave):
"""Checks whether a cave has been properly registered when it is found in the Loser repo """Checks whether a cave has been properly registered when it is found in the Loser repo

View File

@@ -14,7 +14,7 @@
<p>These are survex blocks within a survex file which have NO ATTACHED WALLET. <p>These are survex blocks within a survex file which have NO ATTACHED WALLET.
<br /> <br />
i.e. they have a survex block (begin..end) with no *REF line which refers to the wallet holding the raw data for that block of data. i.e. they have a survex block (begin..end) with no *REF line which refers to the wallet holding the raw data for that block of data.
<p>These have "; Messteam", "; Zeichner", "; Gerätefehler:" or "; "LUSS Dead Mountains" in the survex block, so are non expo surveys. <p>These have {{non_cucc_signifiers}} in the survex block, so are non expo surveys.
<table> <table>
<tr><th>survex block with no *ref</th><th>date</th><th>parent block</th><th>within survex file</th><th>surveyed length</th> <tr><th>survex block with no *ref</th><th>date</th><th>parent block</th><th>within survex file</th><th>surveyed length</th>
<th>*ref text</th> <th>*ref text</th>
@@ -23,21 +23,21 @@ i.e. they have a survex block (begin..end) with no *REF line which refers to the
<tr> <tr>
<td style="text-align:center"> {{ sb }} </td> <td style="text-align:center"> {{ sb }} </td>
<td style="text-align:center"><a href="/wallets/year/{{sb.year}}">{{sb.date }}</a> </td> <td style="text-align:center"><a href="/wallets/year/{{sb.year}}">{{sb.date }}</a> </td>
<td style="text-align:center"> {{sb.parent }} </td> <td style="text-align:center"> <a href="/survexfile/{{sb.parent.survexfile}}">{{sb.parent }}</a> </td>
<td style="text-align:left"> <a href="{% url "svx" sb.survexfile.path %}">{{sb.survexfile.path}}</a> </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> <td style="text-align:center"> {{sb.legslength|floatformat:"1g" }}m </td>
<td style="text-align:left"> {% if sb.ref_text %}{{sb.ref_text|truncatechars:50 }}{% endif %} </td> <td style="text-align:left"> {% if sb.ref_text %}{{sb.ref_text|truncatechars:50 }}{% endif %} </td>
{% endfor %} {% endfor %}
</table> </table>
<p>These do not have "; Messteam", "; Zeichner", "; Gerätefehler:" or "; "LUSS Dead Mountains" in the survex block, so are <em>probably</em> expo surveys; definitely if they have identified expo team members (or have zero length). <p>These do not have {{non_cucc_signifiers}} in the survex block, so are <em>probably</em> expo surveys; definitely if they have identified expo team members (or have zero length).
<table> <table>
<tr><th>survex block with no *ref</th><th>date</th><th>parent block</th><th>within survex file</th><th>surveyed length</th><th>team</th><th>*ref text</th></tr> <tr><th>survex block with no *ref</th><th>date</th><th>parent block</th><th width=15%>within survex file</th><th>surveyed length</th><th>team</th><th>*ref text</th></tr>
{% for sb in svxwild %} {% for sb in svxwild %}
<tr> <tr>
<td style="text-align:center"> {{ sb }} </td> <td style="text-align:center"> {{ sb }} </td>
<td style="text-align:center"><a href="/wallets/year/{{sb.year}}">{{sb.date }}</a> </td> <td style="text-align:center"><a href="/wallets/year/{{sb.year}}">{{sb.date }}</a> </td>
<td style="text-align:center"> {{sb.parent }} </td> <td style="text-align:center"> <a href="/survexfile/{{sb.parent.survexfile}}">{{sb.parent }}</a></td>
<td style="text-align:left"> <a href="{% url "svx" sb.survexfile.path %}">{{sb.survexfile.path}}</a> </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> <td style="text-align:center"> {{sb.legslength|floatformat:"1g" }}m </td>
<td style="text-align:center"> {{sb.team|truncatechars:50 }} </td> <td style="text-align:center"> {{sb.team|truncatechars:50 }} </td>