diff --git a/src/Repository/AssignmentRepository.php b/src/Repository/AssignmentRepository.php index 3520480..9034bb7 100644 --- a/src/Repository/AssignmentRepository.php +++ b/src/Repository/AssignmentRepository.php @@ -87,11 +87,16 @@ class AssignmentRepository extends ServiceEntityRepository ->setParameter('now', new \DateTimeImmutable()) ; - if (0 === $teamer->getTrainingAttendances()->count() && 0 === $teamer->getLicenses()->count()) { + // exclude job profiles that require trainings for teamers that didn't attend any + if (0 === $teamer->getTrainingAttendances()->count()) { + $qb->andWhere($qb->expr()->isNull('required_training')); + } + + // exclude job profiles that require licenses for teamers that don't have any + if (0 === $teamer->getLicenses()->count()) { $qb ->andWhere($qb->expr()->eq('job_profile.requiredLicenses', ':requiredLicenses')) ->setParameter('requiredLicenses', '[]') - ->andWhere($qb->expr()->isNull('required_training')) ; }