fix: called-off dispositions no longer block teamers
This commit is contained in:
@@ -372,12 +372,31 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
}
|
||||
|
||||
private function getAvailableAssignmentsIds(): array
|
||||
{
|
||||
$availableAssignments = $this
|
||||
->getAvailableAssignmentsIdsQuery()
|
||||
->getArrayResult()
|
||||
;
|
||||
|
||||
return array_column($availableAssignments, 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* A called-off disposition does not occupy a slot any more: the assignment has to show up as
|
||||
* available again - both for the teamer who was called off and for everybody else.
|
||||
*/
|
||||
public function getAvailableAssignmentsIdsQuery(): Query
|
||||
{
|
||||
$qb = $this->createQueryBuilder('assignment');
|
||||
|
||||
$availableAssignments = $qb
|
||||
return $qb
|
||||
->select('assignment.id', 'assignment.availableDispositions')
|
||||
->leftJoin('assignment.dispositions', 'disposition')
|
||||
->leftJoin(
|
||||
'assignment.dispositions',
|
||||
'disposition',
|
||||
Join::WITH,
|
||||
$qb->expr()->neq('disposition.status', ':dispositionCalledOff')
|
||||
)
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->where($qb->expr()->andX(
|
||||
$qb->expr()->orX(
|
||||
@@ -393,12 +412,10 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
->groupBy('assignment.id', 'assignment.availableDispositions')
|
||||
->having($qb->expr()->gt('assignment.availableDispositions', $qb->expr()->count('disposition.id')))
|
||||
->setParameter('status', [Assignment::STATUS_DRAFT, Assignment::STATUS_CALLED_OFF])
|
||||
->setParameter('dispositionCalledOff', Disposition::STATUS_CALLED_OFF)
|
||||
->setParameter('now', new \DateTimeImmutable())
|
||||
->getQuery()
|
||||
->getArrayResult()
|
||||
;
|
||||
|
||||
return array_column($availableAssignments, 'id');
|
||||
}
|
||||
|
||||
public function getSelectableHotelCodes(): array
|
||||
|
||||
Reference in New Issue
Block a user