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

revised tables

This commit is contained in:
2025-07-31 12:25:53 +02:00
parent f76fd8ab65
commit c2c70e6a95
2 changed files with 34 additions and 20 deletions

View File

@@ -328,6 +328,23 @@ def stations(request):
return render(request, "stations.html", {"ents": ents, "gpsents": gpsents, "stations": stations, "year": current_expo()})
def old_key(p):
"""This function goes into a lexicographic sort function, and the values are strings,
but we want to sort numerically.
Skip people who have never been on expo.
"""
last = p.last()
if last:
if last.expedition:
# print(p,p.last().expedition)
return int(p.last().expedition.year)
else:
print(p,p.last())
else:
print(f"{p} never attended expo")
return 2050
def aliases(request, year):
"""Page which displays a list of all the person aliases in a specific year"""
@@ -337,13 +354,17 @@ def aliases(request, year):
expo = Expedition.objects.filter(year=year)[0] # returns a set, even though we know there is only one
personexpeditions = PersonExpedition.objects.filter(expedition=expo)
persons = list(Person.objects.all().order_by("last_name"))
oldpersons = persons
oldpersons.sort(key=old_key)
print(len(oldpersons))
aliases = GetPersonExpeditionNameLookup(expo)
aliasdict = {}
for i in sorted(aliases):
aliasdict[i] = aliases[i]
invert = {}
return render(
request,
@@ -352,8 +373,8 @@ def aliases(request, year):
"year": year,
"aliasdict": aliasdict,
"foreign_friends": foreign_friends,
"invert": invert,
"personexpeditions": personexpeditions,
"persons": persons,
"oldpersons": oldpersons,
},
)