chore: cleanup, updated docs
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
- `BookingFingerprintService` - Dirty state detection for edit mode
|
- `BookingFingerprintService` - Dirty state detection for edit mode
|
||||||
- `TravelDataService` - API integration and caching
|
- `TravelDataService` - API integration and caching
|
||||||
- `ParticipantCardDataService` - Card display data
|
- `ParticipantCardDataService` - Card display data
|
||||||
- `InsuranceMatchingService` - Insurance eligibility and auto-reassignment
|
- `InsuranceService` - Consolidated insurance operations (eligibility, type filtering, reassignment) with request-scoped caching
|
||||||
- `RoomAssignmentService` - Automatic room assignment
|
- `RoomAssignmentService` - Automatic room assignment
|
||||||
|
|
||||||
## Critical Patterns
|
## Critical Patterns
|
||||||
@@ -191,7 +191,7 @@ Critical for correct pricing and auto-reassignment:
|
|||||||
### Bulk Insurance Booking
|
### Bulk Insurance Booking
|
||||||
- Applicant enables bulk → applies to all participants
|
- Applicant enables bulk → applies to all participants
|
||||||
- `BulkInsuranceBookingCondition` hides dependent participant insurance fields
|
- `BulkInsuranceBookingCondition` hides dependent participant insurance fields
|
||||||
- Uses `InsuranceMatchingService::batchAssignInsuranceToParticipants()` for price tier matching
|
- Uses `InsuranceService::batchAssignInsuranceToParticipants()` for price tier matching
|
||||||
|
|
||||||
## Data Flow
|
## Data Flow
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ Critical for correct pricing and auto-reassignment:
|
|||||||
- **Insurance IDs**: Always use strings, not integers (e.g., `'100'` not `100`)
|
- **Insurance IDs**: Always use strings, not integers (e.g., `'100'` not `100`)
|
||||||
- **Room properties**: Use `$label` property, not `$name`
|
- **Room properties**: Use `$label` property, not `$name`
|
||||||
- **Participant names**: Index 0 expects "Anmelder:in", others expect "Teilnehmer:in N" (1-based)
|
- **Participant names**: Index 0 expects "Anmelder:in", others expect "Teilnehmer:in N" (1-based)
|
||||||
- **Mock dependencies**: Ensure all constructor dependencies have mocks (especially new ones like `InsuranceLoader`, `InsuranceTypeFilterService`)
|
- **Mock dependencies**: Ensure all constructor dependencies have mocks. Note: `InsuranceService` is stateless with no dependencies (no mocking required)
|
||||||
- **Insurance mutability**: In edit mode, insurances are always readonly (API limitation)
|
- **Insurance mutability**: In edit mode, insurances are always readonly (API limitation)
|
||||||
|
|
||||||
## File Locations
|
## File Locations
|
||||||
|
|||||||
@@ -315,8 +315,10 @@ class BookingPriceCalculatorService
|
|||||||
*
|
*
|
||||||
* @return float The total price for the specified participant excluding insurance and non-calculated services
|
* @return float The total price for the specified participant excluding insurance and non-calculated services
|
||||||
*/
|
*/
|
||||||
public function calculateIndividualParticipantPriceExcludingInsurance(BookingDto $bookingDto, int $participantIndex): float
|
public function calculateIndividualParticipantPriceExcludingInsurance(
|
||||||
{
|
BookingDto $bookingDto,
|
||||||
|
int $participantIndex,
|
||||||
|
): float {
|
||||||
$participant = $bookingDto->getParticipant($participantIndex);
|
$participant = $bookingDto->getParticipant($participantIndex);
|
||||||
if (null === $participant) {
|
if (null === $participant) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
@@ -591,8 +593,12 @@ class BookingPriceCalculatorService
|
|||||||
*
|
*
|
||||||
* @return float The total service cost for this participant
|
* @return float The total service cost for this participant
|
||||||
*/
|
*/
|
||||||
private function calculateParticipantServiceTotal(ParticipantDto $participant, bool $includeInsurance = true, ?BookingDto $bookingDto = null, bool $onlyInsuranceCalculationServices = false): float
|
private function calculateParticipantServiceTotal(
|
||||||
{
|
ParticipantDto $participant,
|
||||||
|
bool $includeInsurance = true,
|
||||||
|
?BookingDto $bookingDto = null,
|
||||||
|
bool $onlyInsuranceCalculationServices = false,
|
||||||
|
): float {
|
||||||
$serviceTotal = 0.0;
|
$serviceTotal = 0.0;
|
||||||
|
|
||||||
// Single service selections
|
// Single service selections
|
||||||
|
|||||||
@@ -55,8 +55,12 @@ class InsuranceService
|
|||||||
*
|
*
|
||||||
* @return array<Insurance> Filtered array of eligible insurances, sorted by price
|
* @return array<Insurance> Filtered array of eligible insurances, sorted by price
|
||||||
*/
|
*/
|
||||||
public function getEligibleInsurances(array $insurances, ParticipantDto $participant, BookingDto $booking, float $travelPrice): array
|
public function getEligibleInsurances(
|
||||||
{
|
array $insurances,
|
||||||
|
ParticipantDto $participant,
|
||||||
|
BookingDto $booking,
|
||||||
|
float $travelPrice
|
||||||
|
): array {
|
||||||
$travelStartDate = $booking->travel->dateFrom;
|
$travelStartDate = $booking->travel->dateFrom;
|
||||||
$travelEndDate = $booking->travel->dateTo;
|
$travelEndDate = $booking->travel->dateTo;
|
||||||
|
|
||||||
@@ -99,8 +103,13 @@ class InsuranceService
|
|||||||
*
|
*
|
||||||
* @return Insurance|null The reassigned insurance or null if no suitable match found
|
* @return Insurance|null The reassigned insurance or null if no suitable match found
|
||||||
*/
|
*/
|
||||||
public function reassignInsuranceForPriceChange(array $availableInsurances, Insurance $currentInsurance, ParticipantDto $participant, BookingDto $booking, float $travelPrice): ?Insurance
|
public function reassignInsuranceForPriceChange(
|
||||||
{
|
array $availableInsurances,
|
||||||
|
Insurance $currentInsurance,
|
||||||
|
ParticipantDto $participant,
|
||||||
|
BookingDto $booking,
|
||||||
|
float $travelPrice
|
||||||
|
): ?Insurance {
|
||||||
// Group insurances of the same type
|
// Group insurances of the same type
|
||||||
$sameTypeInsurances = $this->filterByType($availableInsurances, $currentInsurance);
|
$sameTypeInsurances = $this->filterByType($availableInsurances, $currentInsurance);
|
||||||
|
|
||||||
@@ -125,8 +134,12 @@ class InsuranceService
|
|||||||
*
|
*
|
||||||
* @return array<int, Insurance|null> Array indexed by participant index with assigned insurances
|
* @return array<int, Insurance|null> Array indexed by participant index with assigned insurances
|
||||||
*/
|
*/
|
||||||
public function batchAssignInsuranceToParticipants(array $availableInsurances, Insurance $selectedInsurance, BookingDto $booking, array $participantPrices): array
|
public function batchAssignInsuranceToParticipants(
|
||||||
{
|
array $availableInsurances,
|
||||||
|
Insurance $selectedInsurance,
|
||||||
|
BookingDto $booking,
|
||||||
|
array $participantPrices
|
||||||
|
): array {
|
||||||
$assignments = [];
|
$assignments = [];
|
||||||
|
|
||||||
// Group insurances of the same type
|
// Group insurances of the same type
|
||||||
@@ -264,8 +277,11 @@ class InsuranceService
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkAgeConstraints(Insurance $insurance, ParticipantDto $participant, \DateTimeImmutable $travelStartDate): bool
|
private function checkAgeConstraints(
|
||||||
{
|
Insurance $insurance,
|
||||||
|
ParticipantDto $participant,
|
||||||
|
\DateTimeImmutable $travelStartDate
|
||||||
|
): bool {
|
||||||
$participantAge = $participant->getAge($travelStartDate);
|
$participantAge = $participant->getAge($travelStartDate);
|
||||||
|
|
||||||
// If no birth date is provided, skip age constraints (field will be hidden via field state conditions)
|
// If no birth date is provided, skip age constraints (field will be hidden via field state conditions)
|
||||||
@@ -286,8 +302,11 @@ class InsuranceService
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkTravelDateConstraints(Insurance $insurance, \DateTimeImmutable $travelStartDate, \DateTimeImmutable $travelEndDate): bool
|
private function checkTravelDateConstraints(
|
||||||
{
|
Insurance $insurance,
|
||||||
|
\DateTimeImmutable $travelStartDate,
|
||||||
|
\DateTimeImmutable $travelEndDate
|
||||||
|
): bool {
|
||||||
// Check travel start date
|
// Check travel start date
|
||||||
if (null !== $insurance->travelDateFrom && $travelStartDate < $insurance->travelDateFrom) {
|
if (null !== $insurance->travelDateFrom && $travelStartDate < $insurance->travelDateFrom) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user