feat: refactor staffing status assignment and filtering
This commit is contained in:
@@ -40,7 +40,6 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
->leftJoin('assignment.applications', 'application')
|
||||
->leftJoin('assignment.dispositions', 'disposition')
|
||||
->leftJoin('disposition.teamer', 'teamer')
|
||||
->groupBy('assignment')
|
||||
;
|
||||
|
||||
$this->applyFilterSettings($filterDto, $qb);
|
||||
@@ -117,27 +116,11 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
;
|
||||
}
|
||||
|
||||
if (null !== $status = $filterDto->getStatus()) {
|
||||
switch ($status) {
|
||||
case Assignment::STATUS_STAFFED:
|
||||
$qb->having('assignment.availableDispositions = COUNT(disposition.id)');
|
||||
break;
|
||||
case Assignment::STATUS_PARTLY_STAFFED:
|
||||
$qb
|
||||
->having('COUNT(disposition.id) > 0')
|
||||
->andHaving('assignment.availableDispositions > COUNT(disposition.id)')
|
||||
;
|
||||
break;
|
||||
case Assignment::STATUS_STAFFING:
|
||||
$qb
|
||||
->having('COUNT(disposition.id) = 0')
|
||||
->andHaving('COUNT(application.id) > 0')
|
||||
;
|
||||
break;
|
||||
case Assignment::STATUS_UNSTAFFED:
|
||||
$qb->having('COUNT(disposition.id) = 0');
|
||||
break;
|
||||
}
|
||||
if (0 < count($filterDto->getStatus())) {
|
||||
$qb
|
||||
->andWhere($qb->expr()->in('assignment.staffingStatus', ':status'))
|
||||
->setParameter('status', $filterDto->getStatus())
|
||||
;
|
||||
}
|
||||
|
||||
if (null !== $dateFrom = $filterDto->getDateFrom()) {
|
||||
|
||||
Reference in New Issue
Block a user