wip: age based filtering of options
This commit is contained in:
@@ -49,12 +49,12 @@ class ServiceAgeEvaluator
|
||||
return false; // Cannot evaluate without birth date
|
||||
}
|
||||
|
||||
return match($service->ageConstraintType) {
|
||||
return match ($service->ageConstraintType) {
|
||||
'absolute_age' => $this->evaluateAbsoluteAge($service, $participant->dateOfBirth),
|
||||
'birth_year' => $this->evaluateBirthYear($service, $participant->dateOfBirth),
|
||||
'mixed' => $this->evaluateAbsoluteAge($service, $participant->dateOfBirth)
|
||||
'mixed' => $this->evaluateAbsoluteAge($service, $participant->dateOfBirth)
|
||||
&& $this->evaluateBirthYear($service, $participant->dateOfBirth),
|
||||
default => true // No constraints or unknown type
|
||||
default => true, // No constraints or unknown type
|
||||
};
|
||||
}
|
||||
|
||||
@@ -133,13 +133,13 @@ class ServiceAgeEvaluator
|
||||
*/
|
||||
public function getConstraintDescription(Service $service): string
|
||||
{
|
||||
return match($service->ageConstraintType) {
|
||||
return match ($service->ageConstraintType) {
|
||||
'absolute_age' => $this->getAbsoluteAgeDescription($service),
|
||||
'birth_year' => $this->getBirthYearDescription($service),
|
||||
'mixed' => sprintf('%s and %s',
|
||||
'mixed' => sprintf('%s and %s',
|
||||
$this->getAbsoluteAgeDescription($service),
|
||||
$this->getBirthYearDescription($service)),
|
||||
default => 'No age restrictions'
|
||||
default => 'No age restrictions',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -180,6 +180,7 @@ class ServiceAgeEvaluator
|
||||
if ($service->birthYearFrom === $service->birthYearTo) {
|
||||
return sprintf('Born in %d', $service->birthYearFrom);
|
||||
}
|
||||
|
||||
return sprintf('Born %d-%d', $service->birthYearFrom, $service->birthYearTo);
|
||||
}
|
||||
|
||||
@@ -193,4 +194,4 @@ class ServiceAgeEvaluator
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user