From b4ae2b57d089ba6a5416310ba36d14f54011e4ee Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 18 Mar 2021 18:45:16 -0500 Subject: [PATCH] Quiz: User iid instead of id in queries with entities - refs BT#18452 --- main/exercise/hotspot_answers.as.php | 8 +++----- .../lib/search/tool_processors/quiz_processor.class.php | 9 +++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/main/exercise/hotspot_answers.as.php b/main/exercise/hotspot_answers.as.php index 29e9f364fc..36ef631f44 100755 --- a/main/exercise/hotspot_answers.as.php +++ b/main/exercise/hotspot_answers.as.php @@ -182,14 +182,12 @@ if (!$hideExpectedAnswer) { if ($objQuestion->selectType() == HOT_SPOT_DELINEATION) { $qb - ->where($qb->expr()->eq('a.cId', $courseId)) - ->andWhere($qb->expr()->eq('a.questionId', $questionId)) + ->where($qb->expr()->eq('a.questionId', $questionId)) ->andWhere("a.hotspotType != 'noerror'") - ->orderBy('a.id', 'ASC'); + ->orderBy('a.iid', 'ASC'); } else { $qb - ->where($qb->expr()->eq('a.cId', $courseId)) - ->andWhere($qb->expr()->eq('a.questionId', $questionId)) + ->where($qb->expr()->eq('a.questionId', $questionId)) ->orderBy('a.position', 'ASC'); } diff --git a/main/inc/lib/search/tool_processors/quiz_processor.class.php b/main/inc/lib/search/tool_processors/quiz_processor.class.php index 009e2cabd0..5ce3630c4d 100755 --- a/main/inc/lib/search/tool_processors/quiz_processor.class.php +++ b/main/inc/lib/search/tool_processors/quiz_processor.class.php @@ -1,6 +1,8 @@ getRepository('ChamiloCourseBundle:CQuiz') - ->findOneBy([ - 'id' => $exercise_id, - 'cId' => $course_id, - ]); + $dk_result = $em->find(CQuiz::class, $exercise_id); $name = ''; if ($dk_result) {