diff options
author | Sam Wenham <sam@wenhams.co.uk> | 2019-03-09 18:21:10 +0000 |
---|---|---|
committer | Sam Wenham <sam@wenhams.co.uk> | 2019-03-09 18:21:10 +0000 |
commit | 7a7433bc844b1ac9bd8046e5a996d43ea4c5523e (patch) | |
tree | 7a1207160143422086bcc8c5f2efec1d491375ae /core | |
parent | ff8c5ef0c1df3cbb13b128eac7b3b9e328d99ca2 (diff) | |
download | troggle-7a7433bc844b1ac9bd8046e5a996d43ea4c5523e.tar.gz troggle-7a7433bc844b1ac9bd8046e5a996d43ea4c5523e.tar.bz2 troggle-7a7433bc844b1ac9bd8046e5a996d43ea4c5523e.zip |
Fix people list
Cope with Jimmy McFoo as a name!
Don't set the top expo value in the code whin it is piss easy to calculate
Fix typo from last commit
Diffstat (limited to 'core')
-rw-r--r-- | core/models.py | 8 | ||||
-rw-r--r-- | core/views_logbooks.py | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/core/models.py b/core/models.py index 8cc91ea..1b2875a 100644 --- a/core/models.py +++ b/core/models.py @@ -151,9 +151,15 @@ class Person(TroggleModel): def notability(self): notability = Decimal(0) + max_expo_val = 0 + + max_expo_year = Expedition.objects.all().aggregate(Max('year')) + max_expo_val = int(max_expo_year['year__max']) + 1 + for personexpedition in self.personexpedition_set.all(): if not personexpedition.is_guest: - notability += Decimal(1) / (2012 - int(personexpedition.expedition.year)) + print(personexpedition.expedition.year) + notability += Decimal(1) / (max_expo_val - int(personexpedition.expedition.year)) return notability def bisnotable(self): diff --git a/core/views_logbooks.py b/core/views_logbooks.py index 3ab55d6..0a90d7e 100644 --- a/core/views_logbooks.py +++ b/core/views_logbooks.py @@ -267,4 +267,3 @@ def get_people(request, expeditionslug): def get_logbook_entries(request, expeditionslug): exp = Expedition.objects.get(year = expeditionslug) return render_with_context(request,'options.html', {"items": [(le.slug, "%s - %s" % (le.date, le.title)) for le in exp.logbookentry_set.all()]}) - |