From 7bafe3f24c9c2b856242cad5e4530f63b3792b7b Mon Sep 17 00:00:00 2001 From: msquare Date: Sat, 12 Nov 2016 19:05:36 +0100 Subject: fix shift occupied method --- includes/model/Shifts_model.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'includes/model/Shifts_model.php') diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index aab822b7..1eba5ba1 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -94,15 +94,15 @@ function Shift_collides($shift, $shifts) { * * @param int $shift_id * ID of the shift to check + * @param int $angeltype_id + * ID of the angeltype that should be checked */ -function Shift_occupied($shift_id) { - $needed_angeltypes = NeededAngelTypes_by_shift($shift['SID']); +function Shift_occupied($shift_id, $angeltype_id) { + $needed_angeltypes = NeededAngelTypes_by_shift($shift_id); foreach ($needed_angeltypes as $needed_angeltype) { if ($needed_angeltype['angel_type_id'] == $angeltype['id']) { - if ($needed_angeltype['taken'] < $needed_angeltype['count']) { - return false; - } + return $needed_angeltype['taken'] < $needed_angeltype['count']; } } @@ -136,7 +136,7 @@ function Shift_signup_allowed($shift, $angeltype, $user_angeltype = null, $user_ } // you canot join if shift is full - $user_may_join_shift = ! Shift_occupied($shift['SID']); + $user_may_join_shift = ! Shift_occupied($shift['SID'], $angeltype['id']); // you cannot join if user alread joined a parallel or this shift $user_may_join_shift &= ! Shift_collides($shift, $user_shifts); -- cgit v1.2.3-54-g00ecf