diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-12-30 04:32:03 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-12-30 12:11:51 +0100 |
commit | 1fefe93bc86bed67a0be49e1bd7e87de1bc1304a (patch) | |
tree | 30f49013addd4c5c0d50becfe9c31f77fe460d94 | |
parent | 1bb2c57842373036a63036cc834e21f5838b7bd3 (diff) |
users_controller: formatting
-rw-r--r-- | includes/controller/users_controller.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php index 2fcd90b9..393acca8 100644 --- a/includes/controller/users_controller.php +++ b/includes/controller/users_controller.php @@ -461,16 +461,19 @@ function shiftCalendarRendererByShiftFilter(ShiftsFilter $shiftsFilter) $needed_angeltypes[$shift['SID']] = []; $shift_entries[$shift['SID']] = []; } + foreach ($shift_entries_source as $shift_entry) { if (isset($shift_entries[$shift_entry['SID']])) { $shift_entries[$shift_entry['SID']][] = $shift_entry; } } + foreach ($needed_angeltypes_source as $needed_angeltype) { if (isset($needed_angeltypes[$needed_angeltype['SID']])) { $needed_angeltypes[$needed_angeltype['SID']][] = $needed_angeltype; } } + unset($needed_angeltypes_source); unset($shift_entries_source); @@ -485,19 +488,29 @@ function shiftCalendarRendererByShiftFilter(ShiftsFilter $shiftsFilter) foreach ($shifts as $shift) { $needed_angels_count = 0; $taken = 0; + foreach ($needed_angeltypes[$shift['SID']] as $needed_angeltype) { $taken = 0; + foreach ($shift_entries[$shift['SID']] as $shift_entry) { - if ($needed_angeltype['angel_type_id'] == $shift_entry['TID'] && $shift_entry['freeloaded'] == 0) { + 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) { + + if ( + in_array(ShiftsFilter::FILLED_FREE, $shiftsFilter->getFilled()) + && $taken < $needed_angels_count + ) { $filtered_shifts[] = $shift; } + if ( in_array(ShiftsFilter::FILLED_FILLED, $shiftsFilter->getFilled()) && $taken >= $needed_angels_count |