fix: called-off dispositions no longer block teamers

This commit is contained in:
Björn Fromme
2026-08-26 09:11:27 +02:00
committed by fromme
parent cc280907e5
commit f3eae5462d
8 changed files with 186 additions and 20 deletions
@@ -32,9 +32,12 @@ class CreateController extends AbstractController
$user = $this->getUser();
$teamer = $user->getTeamer();
// Only allow applications on empty slots
$availableSlots = (int) $assignment->getAvailableDispositions();
if (0 > $availableSlots) {
// Only allow applications on empty slots. The teamer list already hides assignments without
// a free slot, so this only catches the way past it: a bookmark or a direct link. Called-off
// dispositions do not occupy a slot, and an assignment without a slot count is treated as
// full - both the same way App\Repository\AssignmentRepository decides what to list.
$availableSlots = (int) $assignment->getAvailableDispositions() - $assignment->getActiveDispositions()->count();
if (0 >= $availableSlots) {
$this->addFlash('error', 'Auf diesem Einsatz sind bereits alle Plätze belegt');
return $this->redirectToRoute('app_teamer_index');
@@ -6,7 +6,6 @@ use App\Controller\Traits\ReturnUrlTrait;
use App\Entity\Assignment;
use App\Entity\User;
use App\Repository\ApplicationRepository;
use App\Repository\DispositionRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -19,7 +18,6 @@ class DetailController extends AbstractController
public function __construct(
private readonly ApplicationRepository $applicationRepository,
private readonly DispositionRepository $dispositionRepository,
) {
}
@@ -39,13 +37,7 @@ class DetailController extends AbstractController
])
;
$disposition = $this
->dispositionRepository
->findOneBy([
'assignment' => $assignment,
'teamer' => $teamer,
])
;
$disposition = $assignment->getActiveDispositionByTeamer($teamer);
$isBookmarked = $teamer->getBookmarks()->contains($assignment);