]> git.mjollnir.org Git - moodle.git/commitdiff
Bug 5971 - Allow matching questions to have extra wrong answers - supplimental. I...
authortjhunt <tjhunt>
Wed, 5 Jul 2006 11:58:14 +0000 (11:58 +0000)
committertjhunt <tjhunt>
Wed, 5 Jul 2006 11:58:14 +0000 (11:58 +0000)
question/type/match/questiontype.php

index c17ca9c0e90a7ef8c18b4ecbad197da8ef9db9cb..a621bed1c08a8a115d71782141e2f1de57ad78da 100644 (file)
@@ -181,13 +181,14 @@ class question_match_qtype extends default_questiontype {
         // Serialize responses
         $responses = array();
         foreach ($state->options->subquestions as $key => $subquestion) {
-            $responses[] = $key.'-'.($state->responses[$key] ? $state->responses[$key] : 0);
+            if ($subquestion->questiontext) {
+                $responses[] = $key.'-'.($state->responses[$key] ? $state->responses[$key] : 0);
+            }
         }
         $responses = implode(',', $responses);
 
         // Set the legacy answer field
-        if (!set_field('question_states', 'answer', $responses, 'id',
-         $state->id)) {
+        if (!set_field('question_states', 'answer', $responses, 'id', $state->id)) {
             return false;
         }
         return true;