fix: don't present unavailable assignments to teamers on their dashboard
This commit is contained in:
@@ -270,6 +270,8 @@ class AssignmentRepository extends ServiceEntityRepository
|
|||||||
|
|
||||||
public function getNewMatchingTeamerProfile(Teamer $teamer, int $limit = 5): array
|
public function getNewMatchingTeamerProfile(Teamer $teamer, int $limit = 5): array
|
||||||
{
|
{
|
||||||
|
$availableAssignmentsIds = $this->getAvailableAssignmentsIds();
|
||||||
|
|
||||||
$qb = $this->createQueryBuilder('assignment');
|
$qb = $this->createQueryBuilder('assignment');
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
@@ -280,21 +282,15 @@ class AssignmentRepository extends ServiceEntityRepository
|
|||||||
->leftJoin('assignment.applications', 'application', Join::WITH, $qb->expr()->eq('application.teamer', ':teamer'))
|
->leftJoin('assignment.applications', 'application', Join::WITH, $qb->expr()->eq('application.teamer', ':teamer'))
|
||||||
->leftJoin('assignment.dispositions', 'disposition', Join::WITH, $qb->expr()->eq('disposition.teamer', ':teamer'))
|
->leftJoin('assignment.dispositions', 'disposition', Join::WITH, $qb->expr()->eq('disposition.teamer', ':teamer'))
|
||||||
->where($qb->expr()->andX(
|
->where($qb->expr()->andX(
|
||||||
$qb->expr()->eq('assignment.status', ':status'),
|
|
||||||
$qb->expr()->neq('assignment.staffingStatus', ':staffingStatus'),
|
$qb->expr()->neq('assignment.staffingStatus', ':staffingStatus'),
|
||||||
$qb->expr()->in('assignment.jobProfile', ':jobProfiles'),
|
$qb->expr()->in('assignment.jobProfile', ':jobProfiles'),
|
||||||
$qb->expr()->isNull('application'),
|
$qb->expr()->isNull('application'),
|
||||||
$qb->expr()->isNull('disposition'),
|
$qb->expr()->isNull('disposition'),
|
||||||
$qb->expr()->orX(
|
$qb->expr()->in('assignment.id', $availableAssignmentsIds)
|
||||||
$qb->expr()->gt('assignment.dateFrom', ':dateFrom'),
|
|
||||||
$qb->expr()->gt('destination.dateFrom', ':dateFrom')
|
|
||||||
)
|
|
||||||
))
|
))
|
||||||
->setParameter('status', Assignment::STATUS_PUBLISHED)
|
|
||||||
->setParameter('staffingStatus', Assignment::STATUS_STAFFED)
|
->setParameter('staffingStatus', Assignment::STATUS_STAFFED)
|
||||||
->setParameter('jobProfiles', $teamer->getJobProfiles())
|
->setParameter('jobProfiles', $teamer->getJobProfiles())
|
||||||
->setParameter('teamer', $teamer)
|
->setParameter('teamer', $teamer)
|
||||||
->setParameter('dateFrom', new \DateTimeImmutable())
|
|
||||||
;
|
;
|
||||||
|
|
||||||
if (0 === $teamer->getTrainingAttendances()->count() && 0 === $teamer->getLicenses()->count()) {
|
if (0 === $teamer->getTrainingAttendances()->count() && 0 === $teamer->getLicenses()->count()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user