Fix correct answers for Matching and Matching Draggable types - refs #7878

1.10.x
Angel Fernando Quiroz Campos 10 years ago
parent 5321bdee71
commit 2de7a58f69
  1. 19
      main/exercice/answer.class.php

@ -621,6 +621,25 @@ class Answer
if ($autoId) {
$sql = "UPDATE $answerTable SET id = iid, id_auto = iid WHERE iid = $autoId";
Database::query($sql);
$questionType = $this->getQuestionType();
if (in_array(
$questionType,
[MATCHING, MATCHING_DRAGGABLE]
)) {
$answer = new Answer($this->questionId);
$answer->read();
$correctAnswerId = $answer->selectAnswerIdByPosition($correct);
$correctAnswerAutoId = $answer->selectAutoId($correctAnswerId);
Database::update(
$answerTable,
['correct' => $correctAnswerAutoId ? $correctAnswerAutoId : 0],
['iid = ?' => $autoId]
);
}
}
} else {
// https://support.chamilo.org/issues/6558

Loading…
Cancel
Save