From fb3247c91e94ae40eaad2c4bcc7086e8c15f4680 Mon Sep 17 00:00:00 2001 From: nkrondraf Date: Tue, 13 Jun 2023 14:44:01 +0200 Subject: [PATCH] performance optimizations --- cis/private/profile/studienplan.php | 43 +++++++++++++++-------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/cis/private/profile/studienplan.php b/cis/private/profile/studienplan.php index f66b66197..8caf7f65d 100644 --- a/cis/private/profile/studienplan.php +++ b/cis/private/profile/studienplan.php @@ -674,38 +674,39 @@ function drawTree($tree, $depth) function checkKompatibleLvs($kompatibleLVs, $student, $row_tree, $noten_arr, $note_pruef_arr, $p, $uid, $negativeNote= null) { + global $anrechnung; $positiv = false; $found = false; $i = 0; + while(!$found && $i < count($kompatibleLVs)) { foreach($kompatibleLVs as $komp) { - - $anrechnung = new anrechnung(); - $anrechnung->getAnrechnungPrestudent($student->prestudent_id, $row_tree->lehrveranstaltung_id, $komp); - - if(count($anrechnung->result) == 1) + if(count($anrechnung->result)) { - $lv = $anrechnung->result[0]->lehrveranstaltung_id_kompatibel; - if(isset($noten_arr[$lv])) + foreach($anrechnung->result as $row) { - $positiv=false; - foreach($noten_arr[$lv] as $note) + $lv = $row->lehrveranstaltung_id_kompatibel; + if(isset($noten_arr[$lv]) && $lv == $komp && $row_tree->lehrveranstaltung_id == $row->lehrveranstaltung_id) { - if($note_pruef_arr[$note]->positiv) - $positiv=true; - } + $positiv=false; + foreach($noten_arr[$lv] as $note) + { + if($note_pruef_arr[$note]->positiv) + $positiv=true; + } - $found = true; - } - else - { - /* wenn zu mehreren kompatiblen lvs eine Anrechnung existiert - * darf found nicht auf false gesetzt werden wenn es zuvor bereits auf true gesetzt wurde - */ - if(!$found) - $found = false; + $found = true; + } + else + { + /* wenn zu mehreren kompatiblen lvs eine Anrechnung existiert + * darf found nicht auf false gesetzt werden wenn es zuvor bereits auf true gesetzt wurde + */ + if(!$found) + $found = false; + } } } $i++;