Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions evap/contributor/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def index(request):
)

own_evaluations = (
Evaluation.objects.filter(course__in=own_courses)
Evaluation.annotate_with_participant_and_voter_counts(Evaluation.objects.filter(course__in=own_courses))
.annotate(contributes_to=Exists(Evaluation.objects.filter(id=OuterRef("id"), contributions__contributor=user)))
.prefetch_related("course", "course__evaluations", "course__programs", "course__type", "course__semester")
)
Expand All @@ -77,9 +77,17 @@ def index(request):
)
)
)
delegated_evaluations = Evaluation.objects.filter(course__in=delegated_courses).prefetch_related(
"course", "course__evaluations", "course__programs", "course__type", "course__semester"
delegated_evaluations = Evaluation.annotate_with_participant_and_voter_counts(
Evaluation.objects.filter(course__in=delegated_courses)
).prefetch_related(
"course",
"course__evaluations",
"course__programs",
"course__type",
"course__semester",
"course__responsibles",
)
Comment on lines +82 to 89
Copy link
Copy Markdown
Member

@richardebeling richardebeling Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these could be select_relateds (course, course__type, course__semester). You could check whether it improves anything, if yes, we can use that


delegated_evaluations = [evaluation for evaluation in delegated_evaluations if evaluation.can_be_seen_by(user)]
for evaluation in delegated_evaluations:
evaluation.delegated_evaluation = True
Expand Down