diff options
-rw-r--r-- | includes/controller/users_controller.php | 13 | ||||
-rw-r--r-- | includes/model/Shifts_model.php | 4 |
2 files changed, 7 insertions, 10 deletions
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php index e891f85d..64f725de 100644 --- a/includes/controller/users_controller.php +++ b/includes/controller/users_controller.php @@ -347,13 +347,14 @@ function shiftCalendarRendererByShiftFilter(ShiftsFilter $shiftsFilter) { foreach ($shifts as $shift) { $needed_angels_count = 0; foreach ($needed_angeltypes[$shift['SID']] as $needed_angeltype) { - $needed_angels_count += $needed_angeltype['count']; - } - $taken = 0; - foreach ($shift_entries[$shift['SID']] as $shift_entry) { - if ($shift_entry['freeloaded'] == 0) { - $taken ++; + $taken = 0; + foreach ($shift_entries[$shift['SID']] as $shift_entry) { + if ($needed_angeltype['angel_type_id'] == $shift_entry['TID'] && $shift_entry['freeloaded'] == 0) { + $taken ++; + } } + + $needed_angels_count += max(0, $needed_angeltype['count'] - $taken); } if (in_array(ShiftsFilter::FILLED_FREE, $shiftsFilter->getFilled()) && $taken < $needed_angels_count) { $filtered_shifts[] = $shift; diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index a9a1cd7f..29156423 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -251,10 +251,6 @@ function Shift_signup_allowed_admin($angeltype, $needed_angeltype, $shift_entrie function Shift_signup_allowed($signup_user, $shift, $angeltype, $user_angeltype = null, $user_shifts = null, $needed_angeltype, $shift_entries) { global $user, $privileges; -// if($shift['SID']==1907) { -// print_r(Shift_signup_allowed_admin($angeltype, $needed_angeltype, $shift_entries)); -// } - if (in_array('user_shifts_admin', $privileges)) { return Shift_signup_allowed_admin($angeltype, $needed_angeltype, $shift_entries); } |