From 94bff3f6e73a716e502d24713b3fb26319aa558e Mon Sep 17 00:00:00 2001 From: Stephan Kergomard Date: Mon, 16 Dec 2024 14:17:49 +0100 Subject: [PATCH] Test: Fix Missing Evaluation Data --- .../class.ilTestEvaluationFactory.php | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Modules/Test/classes/Evaluation/class.ilTestEvaluationFactory.php b/Modules/Test/classes/Evaluation/class.ilTestEvaluationFactory.php index 783dfbfd1ab6..92173a354813 100644 --- a/Modules/Test/classes/Evaluation/class.ilTestEvaluationFactory.php +++ b/Modules/Test/classes/Evaluation/class.ilTestEvaluationFactory.php @@ -104,14 +104,14 @@ protected function queryEvaluationData(array $active_ids): array usr_data.title, usr_data.login - FROM tst_test_result, qpl_questions, tst_active + FROM tst_active + LEFT JOIN tst_test_result ON tst_active.active_id = tst_test_result.active_fi LEFT JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi + LEFT JOIN qpl_questions ON qpl_questions.question_id = tst_test_result.question_fi LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id - WHERE tst_active.active_id = tst_test_result.active_fi - AND qpl_questions.question_id = tst_test_result.question_fi - AND tst_active.test_fi = %s + WHERE tst_active.test_fi = %s AND %s ORDER BY tst_active.active_id ASC, tst_test_result.pass ASC, tst_test_result.tstamp DESC @@ -185,14 +185,16 @@ public function getEvaluationData(): ilTestEvaluationData $pass->setDeductedHintPoints($row['hint_points']); } - $pass->addAnsweredQuestion( - $row["question_fi"], - $row["qpl_maxpoints"], - $row["result_points"], - (bool) $row['answered'], - null, - $row['manual'] - ); + if ($row['question_fi'] !== null) { + $pass->addAnsweredQuestion( + $row["question_fi"], + $row["qpl_maxpoints"], + $row["result_points"], + (bool) $row['answered'], + null, + $row['manual'] + ); + } $user_eval_data->addPass($row['pass'], $pass);