Commit 723bbcbb authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch '899-society-achievements-filter' into 'master'

Fix society filter in member achievements

Closes #899

See merge request !1326
parents a303a39c 6ae41f04
......@@ -12,7 +12,7 @@ from utils.snippets import datetime_to_lectureyear
def _member_group_memberships(
member: Member, skip_condition: Callable[[Membership], bool]
member: Member, condition: Callable[[Membership], bool]
) -> Dict[str, Any]:
Determines the group membership of a user based on a condition
......@@ -22,7 +22,7 @@ def _member_group_memberships(
data = {}
for membership in memberships:
if skip_condition(membership):
if not condition(membership):
period = {
'since': membership.since,
......@@ -59,7 +59,8 @@ def member_achievements(member) -> List:
Committee and board memberships + mentorships
achievements = _member_group_memberships(
member, lambda membership: hasattr(membership, 'society'))
member, lambda membership: (hasattr(, 'board') or
hasattr(, 'committee')))
mentor_years = member.mentorship_set.all()
for mentor_year in mentor_years:
......@@ -80,8 +81,7 @@ def member_societies(member) -> List:
Derives a list of societies a member was part of
societies = _member_group_memberships(member, lambda membership: (
hasattr(, 'board') or
hasattr(, 'committee')))
hasattr(, 'society')))
return sorted(societies.values(), key=lambda x: x['earliest'])
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