From 306a3abc48df42c51115d86faee430c177ba6342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 3 Dec 2025 09:41:37 +0100 Subject: [PATCH] fix: don't present unavailable assignments to teamers on their dashboard --- src/Repository/AssignmentRepository.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Repository/AssignmentRepository.php b/src/Repository/AssignmentRepository.php index 3047866..339a4b1 100644 --- a/src/Repository/AssignmentRepository.php +++ b/src/Repository/AssignmentRepository.php @@ -270,6 +270,8 @@ class AssignmentRepository extends ServiceEntityRepository public function getNewMatchingTeamerProfile(Teamer $teamer, int $limit = 5): array { + $availableAssignmentsIds = $this->getAvailableAssignmentsIds(); + $qb = $this->createQueryBuilder('assignment'); $qb @@ -280,21 +282,15 @@ class AssignmentRepository extends ServiceEntityRepository ->leftJoin('assignment.applications', 'application', Join::WITH, $qb->expr()->eq('application.teamer', ':teamer')) ->leftJoin('assignment.dispositions', 'disposition', Join::WITH, $qb->expr()->eq('disposition.teamer', ':teamer')) ->where($qb->expr()->andX( - $qb->expr()->eq('assignment.status', ':status'), $qb->expr()->neq('assignment.staffingStatus', ':staffingStatus'), $qb->expr()->in('assignment.jobProfile', ':jobProfiles'), $qb->expr()->isNull('application'), $qb->expr()->isNull('disposition'), - $qb->expr()->orX( - $qb->expr()->gt('assignment.dateFrom', ':dateFrom'), - $qb->expr()->gt('destination.dateFrom', ':dateFrom') - ) + $qb->expr()->in('assignment.id', $availableAssignmentsIds) )) - ->setParameter('status', Assignment::STATUS_PUBLISHED) ->setParameter('staffingStatus', Assignment::STATUS_STAFFED) ->setParameter('jobProfiles', $teamer->getJobProfiles()) ->setParameter('teamer', $teamer) - ->setParameter('dateFrom', new \DateTimeImmutable()) ; if (0 === $teamer->getTrainingAttendances()->count() && 0 === $teamer->getLicenses()->count()) {