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:
@@ -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,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user