2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-18 17:07:04 +00:00

fixed bug from people who did not turn up, optimised parsing a bit

This commit is contained in:
2025-07-21 19:24:14 +02:00
parent b5540fd543
commit 9a3651ed8b
3 changed files with 19 additions and 11 deletions

View File

@@ -144,10 +144,16 @@ class Person(TroggleModel):
return sum([personexpedition.surveyedleglength() for personexpedition in self.personexpedition_set.all()])
def first(self):
if self.personexpedition_set.order_by("-expedition"):
return self.personexpedition_set.order_by("-expedition")[0]
else:
return None
def last(self):
if self.personexpedition_set.order_by("expedition"):
return self.personexpedition_set.order_by("expedition")[0]
else:
return None
# moved from personexpedition
def name(self):

View File

@@ -680,22 +680,24 @@ def read_cave(filename, mvf=None, cave=None):
else:
# print(f"eslug {eslug} looking up entrance ")
try:
entrance_count = Entrance.objects.filter(slug=eslug).count()
entrance_e = Entrance.objects.filter(slug=eslug)
except:
message = f"! Fail entrance count {eslug}. {entrance_count=}"
print(message)
if entrance_count == 1:
entrance = Entrance.objects.get(slug=eslug)
if entrance_e.count() == 1:
entrance = entrance_e[0]
# entrance = Entrance.objects.get(slug=eslug)
entrances_xslug[eslug] = entrance
else:
message = f"! Entrance count {entrance_count=} for {eslug}. "
message = f"! Entrance count {entrance_e.count()=} for {eslug}. "
print(message)
eslug = eslug[:-1] + eslug[-1].upper()
entrance_count = Entrance.objects.filter(slug=eslug).count()
message = f"! Entrance count {entrance_count=} for uppercase variant {eslug}. "
entrance_e = Entrance.objects.filter(slug=eslug)
message = f"! Entrance count {entrance_e.count()=} for uppercase variant {eslug}. "
print(message)
if entrance_count == 1:
entrance = Entrance.objects.get(slug=eslug)
if entrance_e.count() == 1:
entrance = entrance_e[0]
# entrance = Entrance.objects.get(slug=eslug)
entrances_xslug[eslug] = entrance
message = f"! Warning entrance loading {eslug} only exists as upper case variant "
DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.url}_cave_edit/")

View File

@@ -19,7 +19,7 @@
{% endfor %}
</table>
<p>This is based purely on attendance, not on activities, surveying or usefulness of any kind.
But as Woody Allen said: "90% of success is just turning up".
But as Woody Allen said: "80% of success is showing up".
This is mostly people who have been within the past three years, with an additional bias for number of attendances since 1976.
The metric is just a geometric "recency" (1/2 for attending last year, 1/3 for the year before, etc., added up.)
The display cuttoff is 1/3 so if you came just once, three years ago, you are on the list.