Quiz: User iid instead of id in queries with entities - refs BT#18452

pull/3824/head
Angel Fernando Quiroz Campos 5 years ago
parent bcc22fbfdb
commit b4ae2b57d0
  1. 8
      main/exercise/hotspot_answers.as.php
  2. 9
      main/inc/lib/search/tool_processors/quiz_processor.class.php

@ -182,14 +182,12 @@ if (!$hideExpectedAnswer) {
if ($objQuestion->selectType() == HOT_SPOT_DELINEATION) { if ($objQuestion->selectType() == HOT_SPOT_DELINEATION) {
$qb $qb
->where($qb->expr()->eq('a.cId', $courseId)) ->where($qb->expr()->eq('a.questionId', $questionId))
->andWhere($qb->expr()->eq('a.questionId', $questionId))
->andWhere("a.hotspotType != 'noerror'") ->andWhere("a.hotspotType != 'noerror'")
->orderBy('a.id', 'ASC'); ->orderBy('a.iid', 'ASC');
} else { } else {
$qb $qb
->where($qb->expr()->eq('a.cId', $courseId)) ->where($qb->expr()->eq('a.questionId', $questionId))
->andWhere($qb->expr()->eq('a.questionId', $questionId))
->orderBy('a.position', 'ASC'); ->orderBy('a.position', 'ASC');
} }

@ -1,6 +1,8 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CQuiz;
/** /**
* Process exercises before pass it to search listing scripts. * Process exercises before pass it to search listing scripts.
* *
@ -108,12 +110,7 @@ class quiz_processor extends search_processor
if (!empty($course_information)) { if (!empty($course_information)) {
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
$dk_result = $em $dk_result = $em->find(CQuiz::class, $exercise_id);
->getRepository('ChamiloCourseBundle:CQuiz')
->findOneBy([
'id' => $exercise_id,
'cId' => $course_id,
]);
$name = ''; $name = '';
if ($dk_result) { if ($dk_result) {

Loading…
Cancel
Save