From ec22e31eb99ee1d26df3912ac5e1f0db2a8e57dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Fri, 1 Dec 2023 11:55:50 +0100 Subject: [PATCH] fix: don't show past assignments in teamers' overview --- src/Repository/AssignmentRepository.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Repository/AssignmentRepository.php b/src/Repository/AssignmentRepository.php index d0a7197..2983fdd 100644 --- a/src/Repository/AssignmentRepository.php +++ b/src/Repository/AssignmentRepository.php @@ -55,10 +55,20 @@ class AssignmentRepository extends ServiceEntityRepository ->select('assignment', 'destination', 'job_profile', 'application', 'disposition') ->innerJoin('assignment.destination', 'destination') ->innerJoin('assignment.jobProfile', 'job_profile') - ->where($qb->expr()->isNull('assignment.deletedAt')) + ->where($qb->expr()->andX( + $qb->expr()->orX( + $qb->expr()->gt('destination.dateFrom', ':now'), + $qb->expr()->andX( + $qb->expr()->isNotNull('assignment.dateFrom'), + $qb->expr()->gt('assignment.dateFrom', ':now') + ) + ), + $qb->expr()->isNull('assignment.deletedAt') + )) ->leftJoin('assignment.applications', 'application', Join::WITH, $qb->expr()->eq('application.teamer', ':teamer')) ->leftJoin('assignment.dispositions', 'disposition', Join::WITH, $qb->expr()->eq('disposition.teamer', ':teamer')) ->setParameter('teamer', $teamer) + ->setParameter('now', new \DateTimeImmutable()) ; $this->applyFilterSettings($filterDto, $qb);