wip: booking process, refactor participant room assignment logic

This commit is contained in:
Björn Fromme
2025-07-22 08:52:13 +02:00
parent b3c633dccb
commit 2f5b855bae
16 changed files with 216 additions and 94 deletions
+7 -3
View File
@@ -187,20 +187,24 @@ class Booking
// Sum up all services
foreach ([...$this->transportationServices, ...$this->additionalServices] as $service) {
if (in_array($participantIndex, $service->mapping) || true === $service->mandatory) {
if ((in_array($participantIndex, $service->mapping) || true === $service->mandatory)
&& isset($service->individualPrice[$participantIndex])) {
$price += $service->individualPrice[$participantIndex];
}
}
// Sum up all surcharges
foreach ($this->surcharges as $surcharge) {
if (in_array($participantIndex, $surcharge->mapping)) {
if (in_array($participantIndex, $surcharge->mapping)
&& isset($surcharge->individualPrice[$participantIndex])) {
$price += $surcharge->individualPrice[$participantIndex];
}
}
$room = $this->getRoomForParticipant($participantIndex);
$price += $room->individualPrice[$participantIndex];
if (null !== $room && isset($room->individualPrice[$participantIndex])) {
$price += $room->individualPrice[$participantIndex];
}
return $price;
}