shift colors when signup_requires_arrival and not arrived

This commit is contained in:
Xu 2024-05-23 19:28:43 +02:00 committed by Igor Scheller
parent 13ded8de49
commit 300786e5d0
1 changed files with 8 additions and 8 deletions

View File

@ -430,14 +430,6 @@ function Shift_signup_allowed_angel(
) {
$free_entries = Shift_free_entries($needed_angeltype, $shift_entries);
if (config('signup_requires_arrival') && !$user->state->arrived) {
return new ShiftSignupState(ShiftSignupStatus::NOT_ARRIVED, $free_entries);
}
if (config('signup_advance_hours') && $shift->start->timestamp > time() + config('signup_advance_hours') * 3600) {
return new ShiftSignupState(ShiftSignupStatus::NOT_YET, $free_entries);
}
if (is_null($user_shifts) || $user_shifts->isEmpty()) {
$user_shifts = Shifts_by_user($user->id);
}
@ -489,6 +481,14 @@ function Shift_signup_allowed_angel(
return new ShiftSignupState(ShiftSignupStatus::COLLIDES, $free_entries);
}
if (config('signup_advance_hours') && $shift->start->timestamp > time() + config('signup_advance_hours') * 3600) {
return new ShiftSignupState(ShiftSignupStatus::NOT_YET, $free_entries);
}
if (config('signup_requires_arrival') && !$user->state->arrived) {
return new ShiftSignupState(ShiftSignupStatus::NOT_ARRIVED, $free_entries);
}
// Hooray, shift is free for you!
return new ShiftSignupState(ShiftSignupStatus::FREE, $free_entries);
}