From 8391f93c5b0eaf792aa2121287d42e3e240b5a36 Mon Sep 17 00:00:00 2001 From: Lukas Eichenauer Date: Tue, 12 May 2026 15:53:37 +0200 Subject: [PATCH 1/2] Test: Fix threshold level mapping on same platform See: https://mantis.ilias.de/view.php?id=46734 --- .../classes/class.ilTestSkillLevelThresholdImporter.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/ILIAS/Test/classes/class.ilTestSkillLevelThresholdImporter.php b/components/ILIAS/Test/classes/class.ilTestSkillLevelThresholdImporter.php index a10f4136d347..7ed3bde24b4f 100755 --- a/components/ILIAS/Test/classes/class.ilTestSkillLevelThresholdImporter.php +++ b/components/ILIAS/Test/classes/class.ilTestSkillLevelThresholdImporter.php @@ -158,7 +158,14 @@ public function import(): void $mappedLevelId = $this->getLevelIdMapping($importLevelThreshold->getImportLevelId()); if ($mappedLevelId === null) { - continue(2); + if ( + $existingLevelData['id'] === $importLevelThreshold->getImportLevelId() && + $existingLevelData['skill_id'] === $importLevelThreshold->getImportSkillBaseId() + ) { + $mappedLevelId = $importLevelThreshold->getImportLevelId(); + } else { + continue(2); + } } $threshold = new ilTestSkillLevelThreshold($this->db); From 86e8acae0d5f2bac6e88d68fd528d3b05b142b1b Mon Sep 17 00:00:00 2001 From: Lukas Eichenauer Date: Tue, 26 May 2026 10:58:50 +0200 Subject: [PATCH 2/2] refactor: use early return and improve code structure --- .../class.ilTestSkillLevelThresholdImporter.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/ILIAS/Test/classes/class.ilTestSkillLevelThresholdImporter.php b/components/ILIAS/Test/classes/class.ilTestSkillLevelThresholdImporter.php index 7ed3bde24b4f..c7131af8a1e7 100755 --- a/components/ILIAS/Test/classes/class.ilTestSkillLevelThresholdImporter.php +++ b/components/ILIAS/Test/classes/class.ilTestSkillLevelThresholdImporter.php @@ -158,14 +158,14 @@ public function import(): void $mappedLevelId = $this->getLevelIdMapping($importLevelThreshold->getImportLevelId()); if ($mappedLevelId === null) { - if ( - $existingLevelData['id'] === $importLevelThreshold->getImportLevelId() && - $existingLevelData['skill_id'] === $importLevelThreshold->getImportSkillBaseId() + if( + $existingLevelData['id'] !== $importLevelThreshold->getImportLevelId() + || $existingLevelData['skill_id'] !== $importLevelThreshold->getImportSkillBaseId() ) { - $mappedLevelId = $importLevelThreshold->getImportLevelId(); - } else { continue(2); } + + $mappedLevelId = $importLevelThreshold->getImportLevelId(); } $threshold = new ilTestSkillLevelThreshold($this->db);