fix: stop counting held seats in edit usage

This commit is contained in:
fromme committed 2026-11-04 10:10:37 +01:00
1 parent e9766dbdce
commit d8fe9a3875
2 files changed
+51

No files matched your search

@@ -219,6 +219,10 @@ class ServiceAvailabilityCalculator
/**
* Calculate how many times each service has been selected by other participants.
*
* Only new selections count. In edit mode the form is prefilled with the live booking, whose
* seats BusPro has already deducted from frei; counting them again would report a contingent
* as exhausted while seats are still free.
*
* @param BookingDto $bookingDto The booking data with participant selections
* @param int $currentParticipantIndex The index of the participant currently filling the form
*
@@ -238,6 +242,10 @@ class ServiceAvailabilityCalculator
$participantUsage = $this->countParticipantServiceUsage($participant);
foreach ($participantUsage as $serviceId => $count) {
if (null !== $bookingDto->booking && $bookingDto->booking->hasServiceForParticipant($index, $serviceId)) {
--$count;
}
$serviceUsage[$serviceId] = ($serviceUsage[$serviceId] ?? 0) + $count;
}
}