From 300786e5d00ce22f2d9bc588141ae30b44066d27 Mon Sep 17 00:00:00 2001 From: Xu Date: Thu, 23 May 2024 19:28:43 +0200 Subject: [PATCH] shift colors when signup_requires_arrival and not arrived --- includes/model/Shifts_model.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 2457b026..405b05ab 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -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); }