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()]}) - diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 22674c6..ffd8e21 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -304,7 +304,7 @@ def LoadLogbookForExpedition(expedition): parsefunc = settings.DEFAULT_LOGBOOK_PARSER except (IOError): logbook_parseable = False - print("Couldn't open default logbook file and nothing set for expo " + expo.year) + print("Couldn't open default logbook file and nothing set for expo " + expedition.year) if logbook_parseable: parser = globals()[parsefunc] diff --git a/templates/personindex.html b/templates/personindex.html index a6196a6..1f21b2b 100644 --- a/templates/personindex.html +++ b/templates/personindex.html @@ -31,8 +31,8 @@ {{person|wiki_to_html_short}} {{person.first.expedition.year}} - {{person.last.expedition.year}} - {{ person.surveyedleglength }} + {{person.last.expedition.year}} + {% endfor %} diff --git a/urls.py b/urls.py index 48eda7e..0dbd9a0 100644 --- a/urls.py +++ b/urls.py @@ -40,7 +40,7 @@ actualurlpatterns = patterns('', url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"), url(r'^expeditions/?$', views_logbooks.ExpeditionListView.as_view(), name="expeditions"), - url(r'^personexpedition/(?P[A-Z]*[a-z]*)[^a-zA-Z]*(?P[A-Z]*[a-z]*)/(?P\d+)/?$', views_logbooks.personexpedition, name="personexpedition"), + url(r'^personexpedition/(?P[A-Z]*[a-z]*)[^a-zA-Z]*(?P[A-Z]*[a-zA-Z]*)/(?P\d+)/?$', views_logbooks.personexpedition, name="personexpedition"), url(r'^logbookentry/(?P.*)/(?P.*)/?$', views_logbooks.logbookentry,name="logbookentry"), url(r'^newlogbookentry/(?P.*)$', views_logbooks.newLogbookEntry, name="newLogBookEntry"), url(r'^editlogbookentry/(?P[^/]*)/(?P[^/]*)/(?P[^/]*)/$', views_logbooks.newLogbookEntry, name="editLogBookEntry"),