From c3ff43db6a6b107babb2353a15f6561700c8b6bf Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Tue, 20 Jan 2015 23:05:14 +0000 Subject: [PATCH] Merged in [8843] from rjsparks@nostrum.com:\n Reworked the definition of future_presentations and last_presented. Fixes #1571. - Legacy-Id: 8876 Note: SVN reference [8843] has been migrated to Git commit 80379135318ffd08eb3934547b62660a789483f2 --- ietf/doc/models.py | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/ietf/doc/models.py b/ietf/doc/models.py index 6649b6636..4a8823312 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -195,24 +195,6 @@ class DocumentInfo(models.Model): else: return False - def future_presentations(self): - """ returns related SessionPresentation objects for meetings that - have not yet ended. This implementation allows for 2 week meetings """ - candidate_presentations = self.sessionpresentation_set.filter(session__meeting__date__gte=datetime.date.today()-datetime.timedelta(days=15)) - return sorted([pres for pres in candidate_presentations if pres.session.meeting.end_date()>=datetime.date.today()], key=lambda x:x.session.meeting.date) - - def last_presented(self): - """ returns related SessionPresentation objects for the most recent meeting in the past""" - # Assumes no two meetings have the same start date - if the assumption is violated, one will be chosen arbitrariy - candidate_presentations = self.sessionpresentation_set.filter(session__meeting__date__lte=datetime.date.today()) - candidate_meetings = set([p.session.meeting for p in candidate_presentations if p.session.meeting.end_date()=datetime.date.today()], key=lambda x:x.session.meeting.date) + + def last_presented(self): + """ returns related SessionPresentation objects for the most recent meeting in the past""" + # Assumes no two meetings have the same start date - if the assumption is violated, one will be chosen arbitrariy + candidate_presentations = self.sessionpresentation_set.filter(session__meeting__date__lte=datetime.date.today()) + candidate_meetings = set([p.session.meeting for p in candidate_presentations if p.session.meeting.end_date()