Merged in feature/bugfix-dashboar-open-tasks (pull request #321)

Bugfix: filter out SelfEvaluationFeedback which is not part of course

Approved-by: Christian Cueni
This commit is contained in:
Daniel Egger 2024-05-02 10:34:13 +00:00 committed by Christian Cueni
commit 551116906b
1 changed files with 10 additions and 2 deletions

View File

@ -511,10 +511,18 @@ def _get_mentor_open_tasks_count(course_id: str, mentor: User) -> int:
assignment_user__coursesessionuser__participants__mentor=mentor,
).count()
open_feedback_count = SelfEvaluationFeedback.objects.filter(
open_feedback_qs = SelfEvaluationFeedback.objects.filter(
feedback_provider_user=mentor, # noqa
feedback_requester_user__coursesessionuser__participants__mentor=mentor,
feedback_submitted=False,
).count()
)
# filter open feedbacks for course_id (-> not possible with queryset)
open_feedback_count = len(
[
feedback_entry
for feedback_entry in open_feedback_qs
if str(feedback_entry.learning_unit.get_course().id) == course_id
]
)
return open_assigment_count + open_feedback_count