From 46528fe1d888ae09d125c2ae8ac1952f1d7f29f6 Mon Sep 17 00:00:00 2001 From: msquare Date: Tue, 27 Dec 2016 23:02:05 +0100 Subject: shift view performance improvements --- includes/controller/shifts_controller.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'includes/controller/shifts_controller.php') diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index 1e04c5a8..9ac8a766 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -202,13 +202,17 @@ function shift_controller() { $user_shifts = Shifts_by_user($user); $shift_signup_state = new ShiftSignupState(ShiftSignupState::OCCUPIED, 0); - foreach ($angeltypes as $angeltype) { - $angeltype_signup_state = Shift_signup_allowed($user, $shift, $angeltype, null, $user_shifts); + foreach ($angeltypes as &$angeltype) { + $needed_angeltype = NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype); + $shift_entries = ShiftEntries_by_shift_and_angeltype($shift['SID'], $angeltype['id']); + + $angeltype_signup_state = Shift_signup_allowed($user, $shift, $angeltype, null, $user_shifts, $needed_angeltype, $shift_entries); if ($shift_signup_state == null) { $shift_signup_state = $angeltype_signup_state; } else { $shift_signup_state->combineWith($angeltype_signup_state); } + $angeltype['shift_signup_state'] = $angeltype_signup_state; } return [ -- cgit v1.2.3-54-g00ecf