Commit f754f95f authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch...

Merge branch '513-almost-adjacent-committee-memberships-should-keep-member-since-date' into 'master'

Combine almost-adjacent committee memberships on committee page

Closes #513

See merge request !621
parents 8fa186a6 e7460386
......@@ -249,9 +249,11 @@ class CommitteeMembership(models.Model, metaclass=ModelTranslateMeta):
@property
def initial_connected_membership(self):
""" Find the oldest membership directly connected to the current one"""
qs = CommitteeMembership.objects.filter(committee=self.committee,
qs = CommitteeMembership.objects.filter(
committee=self.committee,
member=self.member,
until=self.since)
until__lte=self.since,
until__gte=self.since - datetime.timedelta(days=1))
if qs.count() >= 1: # should actually only be one; should be unique
return qs.first().initial_connected_membership
else:
......
Markdown is supported
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