diff options
author | msquare <msquare@notrademark.de> | 2016-12-29 15:33:21 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-12-29 15:33:21 +0100 |
commit | b8ebd23f6df8317a2b091335640ddd89de8cc55b (patch) | |
tree | 7190acd8b0ed5cbab945e978a23d583ef6694342 /includes/controller/users_controller.php | |
parent | 51eb22a1c651ffabd10d772b7e06ec05c46c5b86 (diff) |
bring back filtering by occupancy
Diffstat (limited to 'includes/controller/users_controller.php')
-rw-r--r-- | includes/controller/users_controller.php | 13 |
1 files changed, 7 insertions, 6 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; |