diff --git a/config/config.default.php b/config/config.default.php index 98f41785..041bf6ef 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -207,9 +207,16 @@ return [ // Setting this to 0 disables the feature 'signup_advance_hours' => env('SIGNUP_ADVANCE_HOURS', 0), - // Allow signup this many minutes after the start of the shift + // Allow signup this many minutes after the start of the shift. + // If signup_post_fraction is set, first applies that before adding the number of minutes specified by this. 'signup_post_minutes' => env('SIGNUP_POST_MINUTES', 0), + // Allow signup this fraction of the shift length after the start of the shift. + // Example: If this is set to 1, signup is allowed until the end of a shift + // If this is set to 0.5, signup is allowd for the first half of a shift + // If signup_post_minutes is set, first applies this and then adds the signup_post_minutes on top. + 'signup_post_fraction' => env('SIGNUP_POST_FRACTION', 0), + // Number of hours that an angel has to sign out own shifts 'last_unsubscribe' => env('LAST_UNSUBSCRIBE', 3), diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 107430c0..96ec0033 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -358,7 +358,9 @@ function Shift_signup_allowed_angel( return new ShiftSignupState(ShiftSignupState::SIGNED_UP, $free_entries); } - if (time() > $shift['start'] + config('signup_post_minutes') * 60) { + $shift_post_signup_total_allowed_seconds = (config('signup_post_fraction') * ($shift['end'] - $shift['start'])) + (config('signup_post_minutes') * 60); + + if (time() > $shift['start'] + $shift_post_signup_total_allowed_seconds) { // you can only join if the shift is in future return new ShiftSignupState(ShiftSignupState::SHIFT_ENDED, $free_entries); }