wip: feedback about booked and assigned rooms
This commit is contained in:
@@ -102,4 +102,22 @@ class BookingService
|
||||
|
||||
return $participantsCount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculates the number of participants assigned to each room ID.
|
||||
*
|
||||
* @return array<int, int> an array where the key is the room ID and the value is the count of assigned participants
|
||||
*/
|
||||
public function getRoomAssignmentCounts(BookingCreateDto $bookingCreateDto): array
|
||||
{
|
||||
$counts = [];
|
||||
foreach ($bookingCreateDto->participants as $participant) {
|
||||
if (null !== $participant->assignedRoomId) {
|
||||
$counts[$participant->assignedRoomId] = ($counts[$participant->assignedRoomId] ?? 0) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $counts;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user