Skip to content

Commit

Permalink
Merge pull request #554 from OpenUpSA/7th-parliament-attendance-split
Browse files Browse the repository at this point in the history
Attendance split
  • Loading branch information
paulmwatson authored Jul 30, 2024
2 parents 4f93c56 + ca19222 commit 2ac9b4f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pmg/models/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,9 +1493,9 @@ def summary(cls, period=None):
)

if period == "historical":
rows = rows.filter(CommitteeMeeting.date <= "2019-05-31")
rows = rows.filter(CommitteeMeeting.date <= "2024-05-31")
else:
rows = rows.filter(CommitteeMeeting.date >= "2019-06-01")
rows = rows.filter(CommitteeMeeting.date >= "2024-06-01")

rows = rows.order_by(
year.desc(), cls.member_id, CommitteeMeeting.committee_id
Expand Down Expand Up @@ -1527,10 +1527,10 @@ def annual_attendance_trends(cls, to_year=None, period=None):
Returns row tuples: (committe_id, house name, year, n_meetings, avg_attendance, avg_members)
"""
if period == "historical":
start_date = datetime.datetime(2018, 1, 1)
end_date = datetime.datetime(2019, 5, 31)
start_date = datetime.datetime(2023, 1, 1)
end_date = datetime.datetime(2024, 5, 31)
else:
start_date = datetime.datetime(2019, 6, 1)
start_date = datetime.datetime(2024, 6, 1)
end_date = datetime.datetime(to_year, 12, 31)

# attendance
Expand Down Expand Up @@ -1613,9 +1613,9 @@ def committee_attendence_trends(cls, committee_id, period):
)

if period == "current":
query = query.filter(CommitteeMeeting.date >= "2019-06-01")
query = query.filter(CommitteeMeeting.date >= "2024-06-01")
else:
query = query.filter(CommitteeMeeting.date <= "2019-05-31")
query = query.filter(CommitteeMeeting.date <= "2024-05-31")

subquery = query.subquery("attendance")
return (
Expand Down

0 comments on commit 2ac9b4f

Please sign in to comment.