From 35cdac0438dc7399028c2b500a5b0e64bd981295 Mon Sep 17 00:00:00 2001 From: cris-technikum Date: Tue, 12 Oct 2021 10:51:10 +0200 Subject: [PATCH] Small Code Enhencement Signed-off-by: cris-technikum --- .../lehre/anrechnung/ApproveAnrechnungUebersicht.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php index 70fae2b57..25c802caf 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php @@ -379,23 +379,24 @@ class approveAnrechnungUebersicht extends Auth_Controller $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); $result = $this->LehrveranstaltungModel->getLecturersByLv($anrechnung['studiensemester_kurzbz'], $anrechnung['lehrveranstaltung_id']); - if (!$result = getData($result)) + if (!hasData($result)) { show_error('Failed retrieving lectors of Lehrveranstaltung'); } + $lecturersByLv = getData($result); + // Check if lv has LV-Leitung - $key = array_search(true, array_column($result, 'lvleiter')); - + $key = array_search(true, array_column($lecturersByLv, 'lvleiter')); // If lv has LV-Leitung, keep only the one if ($key !== false) { - $lector_arr[]= $result[$key]; + $lector_arr[]= $lecturersByLv[$key]; } // ...otherwise keep all lectors else { - $lector_arr = array_merge($lector_arr, $result); + $lector_arr = array_merge($lector_arr, $lecturersByLv); } }