From 3c5ea577c73f1a6b9144ad8a6e898626ba57c0b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kruli=C5=A1?= Date: Mon, 30 Sep 2024 11:45:45 +0200 Subject: [PATCH] Fixing a bug that pending review and review requests appear in dashboard summary (as well as in mail notifications) even for archived groups (archived groups are now excluded). --- app/model/repository/AssignmentSolutions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/model/repository/AssignmentSolutions.php b/app/model/repository/AssignmentSolutions.php index 93725d9c..8b2960aa 100644 --- a/app/model/repository/AssignmentSolutions.php +++ b/app/model/repository/AssignmentSolutions.php @@ -273,9 +273,11 @@ public function filterBestSolutions(array $solutions): array public function findLingeringReviews(DateTime $threshold): array { $qb = $this->createQueryBuilder('s'); + $qb->innerJoin("s.assignment", "a")->innerJoin("a.group", "g"); $qb->where($qb->expr()->isNull("s.reviewedAt")) ->andWhere($qb->expr()->isNotNull("s.reviewStartedAt")) ->andWhere($qb->expr()->lt("s.reviewStartedAt", ":threshold")) + ->andWhere($qb->expr()->isNull("g.archivedAt")) ->setParameter('threshold', $threshold); return $qb->getQuery()->getResult(); } @@ -293,6 +295,7 @@ public function findPendingReviewsOfTeacher(User $user): array ->andWhere($qb->expr()->in("gm.type", [ GroupMembership::TYPE_ADMIN, GroupMembership::TYPE_SUPERVISOR ])) ->andWhere($qb->expr()->isNotNull("s.reviewStartedAt")) ->andWhere($qb->expr()->isNull("s.reviewedAt")) + ->andWhere($qb->expr()->isNull("g.archivedAt")) ->setParameter('user', $user->getId()); return $qb->getQuery()->getResult(); } @@ -380,6 +383,7 @@ public function findReviewRequestSolutionsOfTeacher(User $user): array ->andWhere($qb->expr()->in("gm.type", [ GroupMembership::TYPE_ADMIN, GroupMembership::TYPE_SUPERVISOR ])) ->andWhere($qb->expr()->isNull("s.reviewStartedAt")) ->andWhere($qb->expr()->eq("s.reviewRequest", 1)) + ->andWhere($qb->expr()->isNull("g.archivedAt")) ->setParameter('user', $user->getId()); return $qb->getQuery()->getResult(); }