From 38043ee35f18b3af7700ee88344d45b6f4f3de56 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sat, 1 Jan 2022 17:24:40 +0100 Subject: [PATCH] Fix list of additional angeltypes on shift view --- includes/view/Shifts_view.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php index 859c723e..60c54484 100644 --- a/includes/view/Shifts_view.php +++ b/includes/view/Shifts_view.php @@ -128,10 +128,13 @@ function Shift_view($shift, $shifttype, Room $room, $angeltypes_source, ShiftSig $needed_angels .= Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin); } - foreach ($shift['ShiftEntry'] as $shiftEntry) { - if (!$neededAngels->where('TID', $shiftEntry['TID'])->first()) { + $shiftEntry = new Collection($shift['ShiftEntry']); + foreach ($shiftEntry->groupBy('TID') as $angelTypes) { + /** @var Collection $angelTypes */ + $type = $angelTypes->first()['TID']; + if (!$neededAngels->where('TID', $type)->first()) { $needed_angels .= Shift_view_render_needed_angeltype([ - 'TID' => $shiftEntry['TID'], + 'TID' => $type, 'count' => 0, 'restricted' => true, 'taken' => true,