Ver código fonte

Save the calculated answer without whished anser - refs #8237

Angel Fernando Quiroz Campos 8 anos atrás
pai
commit
a1f39d1250
1 arquivos alterados com 18 adições e 3 exclusões
  1. 18 3
      main/exercice/exercise.class.php

+ 18 - 3
main/exercice/exercise.class.php

@@ -3823,7 +3823,7 @@ class Exercise
                     $realCorrectTags = $correctTags;
 
                     if ($from_database && empty($calculatedAnswerId)) {
-                        $queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT."
+                        $queryfill = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT."
                                       WHERE
                                         exe_id = '".$exeId."' AND
                                         question_id= ".intval($questionId)  ;
@@ -3854,8 +3854,23 @@ class Exercise
                             // adds a tabulation if no word has been typed by the student
                             $answer .= ''; // remove   that causes issue
                         }
-                        // adds the correct word, followed by ] to close the blank
-                        $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>]';
+
+                        $addCorrecWord = true;
+
+                        if (
+                            Session::has('objExercise') &&
+                            Session::read('objExercise')->selectResultsDisabled() == EXERCISE_FEEDBACK_TYPE_EXAM
+                        ) {
+                            $addCorrecWord = false;
+                        }
+
+                        if ($addCorrecWord) {
+                            // adds the correct word, followed by ] to close the blank
+                            $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>';
+                        }
+
+                        $answer .= ']';
+
                         if (isset($realText[$i +1])) {
                             $answer .= $realText[$i +1];
                         }