2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 08:37:16 +00:00

person attribution of surveyed length working

This commit is contained in:
Philip Sargent
2020-07-06 01:24:43 +01:00
parent 3f9971d2ee
commit 8530b0643d
9 changed files with 70 additions and 37 deletions

View File

@@ -108,6 +108,9 @@ def person(request, first_name='', last_name='', ):
def GetPersonChronology(personexpedition):
'''Horrible bug here whern ther eis more than one survex block per day, it duplicates the entry but gets it wrong
Fortunately this is just the display on this page which is wroing, no bad calculations get into the database.
'''
res = { }
for persontrip in personexpedition.persontrip_set.all():
a = res.setdefault(persontrip.logbook_entry.date, { })
@@ -119,14 +122,13 @@ def GetPersonChronology(personexpedition):
# build up the tables
rdates = sorted(list(res.keys()))
res2 = [ ]
for rdate in rdates:
persontrips = res[rdate].get("persontrips", [])
personroles = res[rdate].get("personroles", [])
for n in range(max(len(persontrips), len(personroles))):
res2.append(((n == 0 and rdate or "--"), (n < len(persontrips) and persontrips[n]), (n < len(personroles) and personroles[n])))
persontrips = res[rdate].get("persontrips", [])
personroles = res[rdate].get("personroles", [])
for n in range(max(len(persontrips), len(personroles) )):
res2.append(((n == 0 and rdate or "--"), (n < len(persontrips) and persontrips[n]), (n < len(personroles) and personroles[n]) ))
return res2