From f1132ea4874b0ef9e4ac7ca26d8048a6cfd5777a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 4 Apr 2024 10:31:43 +0200 Subject: [PATCH] fix: correct filtering of assignments by staffing count --- src/Form/AssignmentFilterType.php | 1 + src/Repository/AssignmentRepository.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Form/AssignmentFilterType.php b/src/Form/AssignmentFilterType.php index 08555b5..4fee226 100644 --- a/src/Form/AssignmentFilterType.php +++ b/src/Form/AssignmentFilterType.php @@ -67,6 +67,7 @@ class AssignmentFilterType extends AbstractType 'choices' => [ 'voll besetzt' => Assignment::STATUS_STAFFED, 'teilweise besetzt' => Assignment::STATUS_PARTLY_STAFFED, + 'unbesetzt' => Assignment::STATUS_UNSTAFFED, 'mit Bewerbungen' => Assignment::STATUS_STAFFING, ], ]); diff --git a/src/Repository/AssignmentRepository.php b/src/Repository/AssignmentRepository.php index 1fe5510..d0edd5b 100644 --- a/src/Repository/AssignmentRepository.php +++ b/src/Repository/AssignmentRepository.php @@ -87,8 +87,8 @@ class AssignmentRepository extends ServiceEntityRepository break; case Assignment::STATUS_PARTLY_STAFFED: $qb - ->having('assignment.availableDispositions > COUNT(disposition.id)') - ->andHaving('COUNT(application.id) = 0') + ->having('COUNT(disposition.id) > 0') + ->andHaving('assignment.availableDispositions > COUNT(disposition.id)') ; break; case Assignment::STATUS_STAFFING: @@ -98,7 +98,7 @@ class AssignmentRepository extends ServiceEntityRepository ; break; case Assignment::STATUS_UNSTAFFED: - $qb->having('assignment.availableDispositions > COUNT(disposition.id)'); + $qb->having('COUNT(disposition.id) = 0'); break; } }