Fix question creation

pull/3844/head
Julio Montoya 5 years ago
parent 9dc848a32a
commit 95bc7b0ec6
  1. 11
      public/main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php
  2. 2
      public/main/exercise/TestCategory.php
  3. 11
      public/main/exercise/exercise.class.php
  4. 8
      public/main/exercise/exercise_show.php

@ -501,12 +501,7 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question
}
// get the max height of item to have each table the same height if displayed side by side
$testCategory = new TestCategory();
foreach ($scoreList as $categoryId => $scoreListForCategory) {
$category = $testCategory->getCategory($categoryId);
if ($category) {
$categoryQuestionName = $category->name;
}
[$noValue, $height] = self::displayDegreeChartChildren(
$scoreListForCategory,
300,
@ -522,12 +517,6 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question
}
}
if (count($scoreList) > 1) {
$boxWidth = $sizeRatio * 300 * 2 + 54;
} else {
$boxWidth = $sizeRatio * 300 + 54;
}
$html = '<div class="row-chart">';
$html .= '<h4 class="chart-title">'.$title.'</h4>';

@ -44,7 +44,7 @@ class TestCategory
$id = (int) $id;
$courseId = empty($courseId) ? api_get_course_int_id() : (int) $courseId;
$sql = "SELECT * FROM $table
WHERE iid = $id AND c_id = ".$courseId;
WHERE iid = $id";
$res = Database::query($sql);
if (Database::num_rows($res)) {

@ -3768,17 +3768,16 @@ class Exercise
$choice = [];
$choiceDegreeCertainty = [];
$sql = "SELECT answer
FROM $TBL_TRACK_ATTEMPT
WHERE
exe_id = $exeId AND question_id = $questionId";
FROM $TBL_TRACK_ATTEMPT
WHERE exe_id = $exeId AND question_id = $questionId";
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
$ind = $row['answer'];
$values = explode(':', $ind);
$myAnswerId = $values[0];
$option = $values[1];
$percent = $values[2];
$myAnswerId = $values[0] ?? null;
$option = $values[1] ?? null;
$percent = $values[2] ?? null;
$choice[$myAnswerId] = $option;
$choiceDegreeCertainty[$myAnswerId] = $percent;
}

@ -337,13 +337,11 @@ $sql = "SELECT attempts.question_id, answer
ON stats_exercises.exe_id = attempts.exe_id
INNER JOIN $TBL_EXERCISE_QUESTION AS quizz_rel_questions
ON
quizz_rel_questions.quiz_id=stats_exercises.exe_exo_id AND
quizz_rel_questions.question_id = attempts.question_id AND
quizz_rel_questions.c_id=".api_get_course_int_id()."
quizz_rel_questions.quiz_id = stats_exercises.exe_exo_id AND
quizz_rel_questions.question_id = attempts.question_id
INNER JOIN $TBL_QUESTIONS AS questions
ON
questions.iid = quizz_rel_questions.question_id AND
questions.c_id = ".api_get_course_int_id()."
questions.iid = quizz_rel_questions.question_id
WHERE
attempts.exe_id = $id $user_restriction
GROUP BY quizz_rel_questions.question_order, attempts.question_id";

Loading…
Cancel
Save