2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-01-19 00:02:56 +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):
"""Recreates the folk.csv file from the database contents
WORK IN PROGRESS JULY 2025
THIS DOES NOT CHECK IN THE FILE with git
"""
def deslugify(slug):
deslug = slug.replace("-"," ",1).title()

View File

@@ -54,11 +54,11 @@ def legs_and_lengths(expos):
if sb.scanswallet == None:
if sb.foreigners:
svxforeign.append(sb)
print(f" FOREIGN {sb.survexfile} {sb.date}")
# print(f" FOREIGN {sb.survexfile} {sb.date}")
foreignlength += sb.legslength
elif sb.name != "rootblock":
svxwild.append(sb)
print(f" WILD {sb.survexfile} {sb.date}")
# print(f" WILD {sb.survexfile} {sb.date}")
wildlength += sb.legslength
sb.year = f"{expedition}"
people = SurvexPersonRole.objects.filter(survexblock=sb)
@@ -71,8 +71,12 @@ def legs_and_lengths(expos):
def svxfilewild(request, year=None):
"""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.
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:
expos = Expedition.objects.all()
@@ -100,6 +104,7 @@ def svxfilewild(request, year=None):
"foreignlength": foreignlength,
"year":year,
"expeditions": Expedition.objects.all(),
"non_cucc_signifiers": non_cucc_signifiers,
"svxwild": svxwild,
"svxforeign": svxforeign}
)

View File

@@ -400,6 +400,7 @@ def svx(request, survex_file):
form.data["code"] = rcode
# GET, also fall-through after POST-specific handling
if svxfile := get_survexfile(survex_file):
print(f"svx(): a real SurvexFile object {svxfile=} {svxfile.id=}")
@@ -418,7 +419,7 @@ def svx(request, survex_file):
svxincludes = re.findall(r"(?i)\*include\s+(\S+)", form.data["code"] or "")
# collect all the survex blocks which actually have a valid date
if svxfile:
if svxfile:
#dirparent = Path(svxfile.primary.path).parent
has_3d = (Path(SVXPATH) / Path(survex_file + ".3d")).is_file()
try:
@@ -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
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"):
return svx(request, cave_shortname)
@@ -769,7 +770,9 @@ def survexcavesingle(request, cave_shortname):
# print(f"many {cave=} => {cave.sds=}")
return render(request, "svxcaves.html", {"settings": settings, "caves": caves, "year": current_expo()})
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):
"""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.
<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.
<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>
<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>
@@ -23,21 +23,21 @@ i.e. they have a survex block (begin..end) with no *REF line which refers to the
<tr>
<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"> {{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:center"> {{sb.legslength|floatformat:"1g" }}m </td>
<td style="text-align:left"> {% if sb.ref_text %}{{sb.ref_text|truncatechars:50 }}{% endif %} </td>
{% endfor %}
</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>
<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 %}
<tr>
<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"> {{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:center"> {{sb.legslength|floatformat:"1g" }}m </td>
<td style="text-align:center"> {{sb.team|truncatechars:50 }} </td>