Fix empty checks

This commit is contained in:
Igor Scheller 2023-01-24 17:40:20 +01:00
parent 37a26c123e
commit bfa0d91704
2 changed files with 3 additions and 3 deletions

View File

@ -307,7 +307,7 @@ function Shift_free_entries(AngelType $needed_angeltype, $shift_entries)
* @param Shift $shift The shift * @param Shift $shift The shift
* @param AngelType $angeltype The angeltype to which the user wants to sign up * @param AngelType $angeltype The angeltype to which the user wants to sign up
* @param array|null $user_angeltype * @param array|null $user_angeltype
* @param SHift[]|Collection|null $user_shifts List of the users shifts * @param Shift[]|Collection|null $user_shifts List of the users shifts
* @param AngelType $needed_angeltype * @param AngelType $needed_angeltype
* @param ShiftEntry[]|Collection $shift_entries * @param ShiftEntry[]|Collection $shift_entries
* @return ShiftSignupState * @return ShiftSignupState
@ -331,7 +331,7 @@ function Shift_signup_allowed_angel(
return new ShiftSignupState(ShiftSignupStatus::NOT_YET, $free_entries); return new ShiftSignupState(ShiftSignupStatus::NOT_YET, $free_entries);
} }
if (empty($user_shifts)) { if (is_null($user_shifts) || $user_shifts->isEmpty()) {
$user_shifts = Shifts_by_user($user->id); $user_shifts = Shifts_by_user($user->id);
} }

View File

@ -242,7 +242,7 @@ function User_last_shift_render($user)
} }
$last_shifts = ShiftEntries_finished_by_user($user); $last_shifts = ShiftEntries_finished_by_user($user);
if (empty($last_shifts)) { if ($last_shifts->isEmpty()) {
return ''; return '';
} }