From 4bb77f799727b4bbaa7b21a786c6db8407ba5b69 Mon Sep 17 00:00:00 2001 From: Liam Middlebrook Date: Mon, 28 Aug 2017 16:46:13 -0400 Subject: [PATCH 1/2] Fix House Meeting Attendance Status Display This probably works. But it's currently untested --- conditional/blueprints/spring_evals.py | 2 +- conditional/util/member.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/conditional/blueprints/spring_evals.py b/conditional/blueprints/spring_evals.py index eb0eabe5..620a7164 100644 --- a/conditional/blueprints/spring_evals.py +++ b/conditional/blueprints/spring_evals.py @@ -49,7 +49,7 @@ def display_spring_evals(internal=False): eval_data = None - h_meetings = [m.meeting_id for m in get_hm(account)] + h_meetings = [m.meeting_id for m in get_hm(account, only_absent=True)] member = { 'name': account.cn, 'uid': uid, diff --git a/conditional/util/member.py b/conditional/util/member.py index 23f7e61c..429e79b3 100644 --- a/conditional/util/member.py +++ b/conditional/util/member.py @@ -128,7 +128,7 @@ def get_cm(member): return c_meetings -def get_hm(member): +def get_hm(member, only_absent=False): h_meetings = MemberHouseMeetingAttendance.query.outerjoin( HouseMeeting, MemberHouseMeetingAttendance.meeting_id == HouseMeeting.id).with_entities( @@ -137,4 +137,6 @@ def get_hm(member): HouseMeeting.date).filter( HouseMeeting.date > start_of_year(), MemberHouseMeetingAttendance.uid == member.uid) + if only_absent: + h_meetings = [hm for hm in h_meetings if hm.attendance_status == "Absent"] return h_meetings From 33169aaa353cabb347fa302a86b139352cea4fe4 Mon Sep 17 00:00:00 2001 From: Marc Billow Date: Mon, 28 Aug 2017 19:21:02 -0400 Subject: [PATCH 2/2] Use SQLAlchemy Filter --- conditional/util/member.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conditional/util/member.py b/conditional/util/member.py index 429e79b3..767ce8cb 100644 --- a/conditional/util/member.py +++ b/conditional/util/member.py @@ -138,5 +138,5 @@ def get_hm(member, only_absent=False): HouseMeeting.date > start_of_year(), MemberHouseMeetingAttendance.uid == member.uid) if only_absent: - h_meetings = [hm for hm in h_meetings if hm.attendance_status == "Absent"] + h_meetings = h_meetings.filter(MemberHouseMeetingAttendance.attendance_status == "Absent") return h_meetings