Browse Source

Fix question GLOBAL_MULTIPLE_ANSWER when importin from excel

BT#12698
jmontoyaa 7 years ago
parent
commit
28667137d7
1 changed files with 9 additions and 6 deletions
  1. 9 6
      main/exercise/upload_exercise.php

+ 9 - 6
main/exercise/upload_exercise.php

@@ -405,15 +405,18 @@ function lp_upload_quiz_action_handling()
                                 // Fixing scores:
                                 switch ($detectQuestionType) {
                                     case GLOBAL_MULTIPLE_ANSWER:
-                                        if (isset($noNegativeScoreList[$i][3])) {
-                                            if (!(strtolower($noNegativeScoreList[$i]) == 'x') &&
-                                                !$correct
-                                            ) {
-                                                $score = $scoreList[$i] * -1;
+                                        if (!$correct) {
+                                            if (isset($noNegativeScoreList[$i])) {
+                                                if (strtolower($noNegativeScoreList[$i]) == 'x') {
+                                                    $score = 0;
+                                                } else {
+                                                    $score = $scoreList[$i] * -1;
+                                                }
                                             }
                                         } else {
-                                            $score = $scoreList[$i] * -1;
+                                            $score = $scoreList[$i];
                                         }
+
                                         $score /= $numberRightAnswers;
                                         break;
                                     case UNIQUE_ANSWER: