diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2020-07-06 01:24:43 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2020-07-06 01:24:43 +0100 |
commit | 8530b0643d552dbaaeef42c8598afd9402338793 (patch) | |
tree | 801c03e5327898270d64e9297629544122f29a3e /core/views_logbooks.py | |
parent | 3f9971d2ee16836095d30785a68e80aefffea949 (diff) | |
download | troggle-8530b0643d552dbaaeef42c8598afd9402338793.tar.gz troggle-8530b0643d552dbaaeef42c8598afd9402338793.tar.bz2 troggle-8530b0643d552dbaaeef42c8598afd9402338793.zip |
person attribution of surveyed length working
Diffstat (limited to 'core/views_logbooks.py')
-rw-r--r-- | core/views_logbooks.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/views_logbooks.py b/core/views_logbooks.py index 1f1e2d1..31b046e 100644 --- a/core/views_logbooks.py +++ b/core/views_logbooks.py @@ -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 |