feat: unassign rooms from other participants when unavailable

This commit is contained in:
Björn Fromme
2025-10-21 17:02:26 +02:00
parent cc1d1e5746
commit ab91c138d5
8 changed files with 576 additions and 95 deletions
+27 -1
View File
@@ -60,7 +60,33 @@
- `TravelDataService` - API integration and caching
- `ParticipantCardDataService` - Card display data
- `InsuranceService` - Consolidated insurance operations (eligibility, type filtering, reassignment) with request-scoped caching
- `RoomAssignmentService` - Automatic room assignment
- `RoomAssignmentService` - Automatic room assignment with intelligent conflict resolution
### Room Reassignment with Conflict Resolution
The room assignment system allows participants to freely select any room from Step 1 selections, with automatic conflict resolution when capacity is exceeded.
**Key Features:**
- **Flexible Selection**: All rooms from Step 1 always appear in participant dropdown, regardless of current capacity
- **Auto-Assignment**: When exactly ONE room type selected, all participants auto-assigned and dropdown disabled
- **Conflict Resolution**: When participant selects room at capacity, system automatically unassigns minimum participants needed
- **Unassignment Priority**: Highest index participants unassigned first (keeps applicant and early participants stable)
- **User Notifications**: Unassigned participants receive warning notifications via toast system
**Implementation:**
- `ParticipantRoomChoiceLoader`: Always includes all selected rooms (no capacity filtering)
- `ParticipantAssignedRoomFieldHandler`: Detects conflicts and resolves via auto-unassignment
- `detectRoomCapacityConflict()`: Calculates if assignment would exceed capacity
- `resolveRoomCapacityConflict()`: Unassigns minimum participants (highest index first)
- Generates notifications for unassigned participants only (not for user-initiated assignment)
- `RoomAssignmentService`: Unchanged - still auto-assigns when single room type selected
- `ParticipantFieldOptionsProvider`: Unchanged - disables dropdown when single room type (auto-assigned)
**Example Scenario:**
- User selects 1x "Doppelzimmer" (capacity 2), 3 participants
- Participants 0 and 1 auto-assigned to "Doppelzimmer"
- Participant 2 manually selects "Doppelzimmer" (at capacity)
- System automatically unassigns Participant 1 (highest index)
- Participant 2 gets assigned, Participant 1 receives warning notification
## Critical Patterns