Unverified Commit 7f809674 authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Use first of consecutive committee memberships

This typically resulted in incorrect dates for committee chairs
who had previously been member of the committee as nonchair
parent d18859db
......@@ -177,6 +177,17 @@ class CommitteeMembership(models.Model, metaclass=ModelTranslateMeta):
def initial_connected_membership(self):
""" Find the oldest membership directly connected to the current one"""
qs = CommitteeMembership.objects.filter(committee=self.committee,
if qs.count() >= 1: # should actually only be one; should be unique
return qs.first().initial_connected_membership
return self
def is_active(self):
"""Is this membership currently active"""
......@@ -22,11 +22,11 @@ def committee_detail(request, id):
memberships = (CommitteeMembership
for membership in memberships:
member = membership.member
member.chair = membership.chair
member.committee_since = membership.since
member.committee_since = membership.initial_connected_membership.since
members.append(member) # list comprehension would be more pythonic?
return render(request, 'activemembers/committee_detail.html',
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment