File tree Expand file tree Collapse file tree 3 files changed +22
-25
lines changed Expand file tree Collapse file tree 3 files changed +22
-25
lines changed Original file line number Diff line number Diff line change 1414from conditional .models .models import Conditional
1515from conditional .models .models import HouseMeeting
1616from conditional .models .models import SpringEval
17- from conditional .models .models import CommitteeMeeting
1817
1918from conditional .util .housing import get_queue_position
2019from conditional .util .flask import render_template
@@ -116,15 +115,6 @@ def display_dashboard():
116115 data ['conditionals' ] = conditionals
117116 data ['conditionals_len' ] = len (conditionals )
118117
119- cm_attendance = [
120- {
121- 'type' : m .committee ,
122- 'datetime' : m .timestamp .date ()
123- } for m in CommitteeMeeting .query .filter (
124- CommitteeMeeting .id .in_ (c_meetings ),
125- CommitteeMeeting .timestamp > start_of_year ()
126- )]
127-
128118 hm_attendance = [
129119 {
130120 'reason' : m .excuse ,
@@ -139,8 +129,8 @@ def display_dashboard():
139129 MemberHouseMeetingAttendance .attendance_status == "Absent" ,
140130 HouseMeeting .date > start_of_year ())]
141131
142- data ['cm_attendance' ] = cm_attendance
143- data ['cm_attendance_len' ] = len (cm_attendance )
132+ data ['cm_attendance' ] = c_meetings
133+ data ['cm_attendance_len' ] = len (c_meetings )
144134 data ['hm_attendance' ] = hm_attendance
145135 data ['hm_attendance_len' ] = len (hm_attendance )
146136
Original file line number Diff line number Diff line change @@ -274,7 +274,7 @@ <h3 class="panel-title">Become Active</h3>
274274 < h3 class ="panel-title "> Housing Status</ h3 >
275275 </ div >
276276 < div class ="panel-body table-fill ">
277-
277+
278278 < table class ="table table-striped table-responsive no-bottom-margin ">
279279 < tbody >
280280 < tr >
@@ -349,10 +349,10 @@ <h3 class="panel-title">Directorship Meeting Attendance</h3>
349349 </ tr >
350350 </ thead >
351351 < tbody >
352- {% for a in cm_attendance %}
352+ {% for meeting in cm_attendance %}
353353 < tr >
354- < td > {{a['type ']}}</ td >
355- < td > {{a['datetime ']}}</ td >
354+ < td > {{meeting['committee ']}}</ td >
355+ < td > {{meeting['timestamp ']}}</ td >
356356 </ tr >
357357 {% endfor %}
358358 </ tbody >
Original file line number Diff line number Diff line change @@ -116,15 +116,22 @@ def get_onfloor_members():
116116
117117
118118def get_cm (member ):
119- try :
120- c_meetings = [m .meeting_id for m in
121- MemberCommitteeAttendance .query .filter (
122- MemberCommitteeAttendance .uid == member .uid
123- ) if CommitteeMeeting .query .filter (
124- CommitteeMeeting .timestamp > start_of_year (),
125- CommitteeMeeting .id == m .meeting_id ).first ().approved ]
126- except AttributeError :
127- c_meetings = []
119+ c_meetings = [{
120+ "uid" : cm .uid ,
121+ "timestamp" : cm .timestamp ,
122+ "committee" : cm .committee
123+ } for cm in CommitteeMeeting .query .join (
124+ MemberCommitteeAttendance ,
125+ MemberCommitteeAttendance .meeting_id == CommitteeMeeting .id
126+ ).with_entities (
127+ MemberCommitteeAttendance .uid ,
128+ CommitteeMeeting .timestamp ,
129+ CommitteeMeeting .committee
130+ ).filter (
131+ CommitteeMeeting .timestamp > start_of_year (),
132+ MemberCommitteeAttendance .uid == member .uid ,
133+ CommitteeMeeting .approved == True # pylint: disable=singleton-comparison
134+ ).all ()]
128135 return c_meetings
129136
130137
You can’t perform that action at this time.
0 commit comments