Sfoglia il codice sorgente

Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

jmontoyaa 8 anni fa
parent
commit
22fbafbcd6

+ 6 - 2
main/exercice/exercise.class.php

@@ -3826,9 +3826,11 @@ class Exercise
                         $queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT."
                                       WHERE
                                         exe_id = '".$exeId."' AND
-                                        question_id= ".intval($questionId)."";
+                                        question_id= ".intval($questionId);
                         $resfill = Database::query($queryfill);
-                        $answer = Database::result($resfill, 0, 'answer');
+                        $rowFill = Database::fetch_assoc($resfill);
+                        $answer = $rowFill['answer'];
+                        $questionScore = $rowFill['marks'];
                     }
 
                     for ($i = 0; $i < count($realCorrectTags); $i++) {
@@ -4604,6 +4606,8 @@ class Exercise
                                 $studentChoice,
                                 $answerComment,
                                 $results_disabled
+                                $results_disabled,
+                                $answerId
                             );
                             break;
                         case HOT_SPOT_DELINEATION:

+ 7 - 5
main/exercice/hotspot_actionscript.as.php

@@ -116,13 +116,15 @@ while ($hotspot = Database::fetch_assoc($result))
 $attemptList = Event::getAllExerciseEventByExeId($exerciseId);
 
 if (!empty($attemptList)) {
-    $questionAttempt = $attemptList[$questionId][0];
+    if (isset($attemptList[$questionId])) {
+        $questionAttempt = $attemptList[$questionId][0];
 
-    if (!empty($questionAttempt['answer'])) {
-        $coordinates = explode('|', $questionAttempt['answer']);
+        if (!empty($questionAttempt['answer'])) {
+            $coordinates = explode('|', $questionAttempt['answer']);
 
-        foreach ($coordinates as $coordinate) {
-            $data['answers'][] = Geometry::decodePoint($coordinate);
+            foreach ($coordinates as $coordinate) {
+                $data['answers'][] = Geometry::decodePoint($coordinate);
+            }
         }
     }
 }

+ 9 - 2
main/inc/lib/exercise.lib.php

@@ -89,6 +89,13 @@ class ExerciseLib
             $objAnswerTmp = new Answer($questionId);
             $nbrAnswers = $objAnswerTmp->selectNbrAnswers();
 
+            if ($answerType == FREE_ANSWER ||
+                $answerType == ORAL_EXPRESSION ||
+                $answerType == CALCULATED_ANSWER
+            ) {
+                $nbrAnswers = 1;
+            }
+
             $quiz_question_options = Question::readQuestionOption(
                 $questionId,
                 $course_id
@@ -622,12 +629,12 @@ class ExerciseLib
                      * the text to find mustn't contains HTML tags
                      * the text to find mustn't contains char "
                      */
-                    global $exe_id;
+                    global $exerciseId;
                     $trackAttempts = Database::get_main_table(
                         TABLE_STATISTIC_TRACK_E_ATTEMPT
                     );
                     $sql = 'SELECT answer FROM ' . $trackAttempts . '
-                            WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId;
+                            WHERE exe_id=' . $exerciseId . ' AND question_id=' . $questionId;
                     $rsLastAttempt = Database::query($sql);
                     $rowLastAttempt = Database::fetch_array($rsLastAttempt);
                     $answer = $rowLastAttempt['answer'];