diff --git a/evap/contributor/views.py b/evap/contributor/views.py index 9fcac49b35..974cd0d201 100644 --- a/evap/contributor/views.py +++ b/evap/contributor/views.py @@ -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") ) @@ -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", ) + delegated_evaluations = [evaluation for evaluation in delegated_evaluations if evaluation.can_be_seen_by(user)] for evaluation in delegated_evaluations: evaluation.delegated_evaluation = True