fix: use a single Meeting instance for all assignments in agenda views (#4877)

This commit is contained in:
Jennifer Richards 2022-12-12 18:33:08 -04:00 committed by GitHub
parent f0966e43f5
commit 5a1fc4c2ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,6 +119,11 @@ def preprocess_assignments_for_agenda(assignments_queryset, meeting, extra_prefe
groups = [ ]
for a in assignments:
if a.session:
# Ensure that all Sessions refer to the same Meeting instance so they can share the
# _groups_at_the_time() cache. The Sessions should all belong to the same meeting, but
# check before blindly assigning to meeting just in case.
if a.session.meeting.pk == meeting.pk:
a.session.meeting = meeting
a.session.order_number = None
if a.session.group and a.session.group not in groups: