Browse Source

Fixing bug when editing multiple answers question -refs #6512

Yoselyn Castillo 11 years ago
parent
commit
4b3e4c3b1c
1 changed files with 6 additions and 5 deletions
  1. 6 5
      main/exercice/answer.class.php

+ 6 - 5
main/exercice/answer.class.php

@@ -442,13 +442,14 @@ class Answer {
 	 * @param	integer	Answer weighting
 	 * @param	integer	Answer position
 	 */
-	function updateAnswers($answer,$comment,$weighting,$position,$destination) {
+	function updateAnswers($answer,$comment, $correct, $weighting,$position,$destination) {
 		$TBL_REPONSES = Database :: get_course_table(TABLE_QUIZ_ANSWER);
 
 		$questionId=$this->questionId;
 		$sql = "UPDATE $TBL_REPONSES SET 
                 answer = '".Database::escape_string($answer)."',
-				comment = '".Database::escape_string($comment)."', 
+				comment = '".Database::escape_string($comment)."',
+                correct = '".Database::escape_string($correct)."', 
 				ponderation = '".Database::escape_string($weighting)."', 
 				position = '".Database::escape_string($position)."', 
 				destination = '".Database::escape_string($destination)."'
@@ -486,12 +487,12 @@ class Answer {
                 $flag = 1;
 			    $sql.="($c_id, '$i','$questionId','$answer','$correct','$comment','$weighting','$position','$hotspot_coordinates','$hotspot_type','$destination'),";
             } else {
-                $this->updateAnswers($answer, $comment, $weighting, $position, $destination);
+                $this->updateAnswers($answer, $comment, $correct, $weighting, $position, $destination);
             }
         }
 		if ($flag == 1) {
-        $sql = api_substr($sql,0,-1);        
-		Database::query($sql);
+            $sql = api_substr($sql,0,-1);        
+            Database::query($sql);
         }
         if (count($this->position) > $this->new_nbrAnswers) {
             $i = $this->new_nbrAnswers+1;