Fixed bug selecting eating habits
This commit is contained in:
@@ -37,11 +37,7 @@ class SignUpCommand {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$eatingHabit = match ($this->request->eating_habit) {
|
||||
'vegan' => EatingHabit::EATING_HABIT_VEGAN,
|
||||
'vegetarian' => EatingHabit::EATING_HABIT_VEGETARIAN,
|
||||
default => EatingHabit::EATING_HABIT_OMNIVOR,
|
||||
};
|
||||
$eatingHabit = $this->resolveEatingHabit();
|
||||
|
||||
$participantAge = new Age($this->request->birthday);
|
||||
|
||||
@@ -111,6 +107,21 @@ class SignUpCommand {
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ernährungsweise auflösen. Übernommen wird nur ein Slug, den die Veranstaltung anbietet; ohne Angabe (z. B. bei
|
||||
* der Kurzanmeldung) oder bei einem nicht angebotenen Wert gilt "Omnivor".
|
||||
*/
|
||||
private function resolveEatingHabit(): string
|
||||
{
|
||||
$slug = $this->request->eating_habit;
|
||||
|
||||
if ($slug !== '' && $this->request->event->eatingHabits()->where('slug', $slug)->exists()) {
|
||||
return $slug;
|
||||
}
|
||||
|
||||
return EatingHabit::EATING_HABIT_OMNIVOR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Badeerlaubnis auflösen. Volljährige brauchen keine Erlaubnis. Für Minderjährige gilt die getroffene Auswahl;
|
||||
* fehlt sie -- weil die Veranstaltung die Badeerlaubnis gar nicht abfragt oder keine Wahl getroffen wurde --,
|
||||
|
||||
Reference in New Issue
Block a user