fix: allow updating room assignments in edit mode

This commit is contained in:
Björn Fromme
2026-03-16 12:02:59 +01:00
parent 380b1ed329
commit f46cc59041
11 changed files with 191 additions and 21 deletions
@@ -122,7 +122,14 @@ class ParticipantAssignedRoomFieldHandler extends AbstractParticipantFieldHandle
}
// Calculate total capacity for this room type
$totalCapacity = $roomSelection->quantity * $roomSelection->capacity;
// In edit mode, use maxQuantity which includes available rooms beyond the booked count.
// In create mode, use quantity which is the user's room selection from step 1.
if (BookingDto::MODE_EDIT === $bookingDto->getMode()) {
$effectiveQuantity = $roomSelection->maxQuantity;
} else {
$effectiveQuantity = $roomSelection->quantity ?? 0;
}
$totalCapacity = $effectiveQuantity * $roomSelection->capacity;
// Count current occupancy (excluding current participant)
$occupancy = 0;
@@ -174,7 +181,12 @@ class ParticipantAssignedRoomFieldHandler extends AbstractParticipantFieldHandle
return; // Shouldn't happen
}
$totalCapacity = $roomSelection->quantity * $roomSelection->capacity;
if (BookingDto::MODE_EDIT === $bookingDto->getMode()) {
$effectiveQuantity = $roomSelection->maxQuantity;
} else {
$effectiveQuantity = $roomSelection->quantity ?? 0;
}
$totalCapacity = $effectiveQuantity * $roomSelection->capacity;
$currentOccupancy = count($participantsWithRoom);
$spacesNeeded = ($currentOccupancy + 1) - $totalCapacity;