Skip to content

Commit

Permalink
Merge branch 'main' into fix-batch-email
Browse files Browse the repository at this point in the history
  • Loading branch information
Reimirno authored Apr 10, 2024
2 parents 505d9a3 + 42f4680 commit 41e2af6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,12 @@ def room(exam, id):
Path: /offerings/<canvas_id>/exams/<exam_name>/rooms/<room_name>
Displays the room diagram, with an optional seat highlighted.
"""
room = Room.query.filter_by(exam_id=exam.id, id=id).first_or_404()
# fetch all seat assignment at this point too to avoid N+1 problem
# we will need to display the seat assignment in the room diagram
from sqlalchemy.orm import joinedload
room = Room.query.options(
joinedload(Room.seats).joinedload(Seat.assignment)
).filter_by(exam_id=exam.id, id=id).first_or_404()
seat_id = request.args.get('seat')
return render_template('room.html.j2', exam=exam, room=room, seat_id=seat_id)
# endregion
Expand Down

0 comments on commit 41e2af6

Please sign in to comment.