Fix PHP warnings.

1.10.x
Julio 9 years ago
parent 4b284c6e7a
commit 32e62f56d8
  1. 10
      main/exercice/exercise.class.php
  2. 6
      main/inc/lib/exercise.lib.php

@ -2440,8 +2440,8 @@ class Exercise
while ($row = Database::fetch_array($result)) {
$ind = $row['answer'];
$values = explode(':', $ind);
$my_answer_id = $values[0];
$option = $values[1];
$my_answer_id = isset($values[0]) ? $values[0] : '';
$option = isset($values[1]) ? $values[1] : '';
$choice[$my_answer_id] = $option;
}
}
@ -2530,12 +2530,12 @@ class Exercise
$ind = $row['answer'];
$result = explode(':',$ind);
if (isset($result[0])) {
$my_answer_id = $result[0];
$option = $result[1];
$my_answer_id = isset($result[0]) ? $result[0] : '';
$option = isset($result[1]) ? $result[1] : '';
$choice[$my_answer_id] = $option;
}
}
$studentChoice = $choice[$answerAutoId];
$studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : '';
if ($answerCorrect == $studentChoice) {
//$answerCorrect = 1;

@ -3579,6 +3579,12 @@ HTML;
$category_was_added_for_this_test = false;
if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) {
if (!isset($category_list[$objQuestionTmp->category]['score'])) {
$category_list[$objQuestionTmp->category]['score'] = 0;
}
if (!isset($category_list[$objQuestionTmp->category]['total'])) {
$category_list[$objQuestionTmp->category]['total'] = 0;
}
$category_list[$objQuestionTmp->category]['score'] += $my_total_score;
$category_list[$objQuestionTmp->category]['total'] += $my_total_weight;
$category_was_added_for_this_test = true;

Loading…
Cancel
Save