]> git.mjollnir.org Git - moodle.git/commitdiff
omit empty answers from JQuiz import
authorgbateson <gbateson>
Sat, 3 Feb 2007 00:36:18 +0000 (00:36 +0000)
committergbateson <gbateson>
Sat, 3 Feb 2007 00:36:18 +0000 (00:36 +0000)
question/format/hotpot/format.php

index db33a3c3c3dcb236dc1b2326bc0e8d9b197a2987..fe4c2544c944bee941f368610ca5a046132d544e 100644 (file)
@@ -433,9 +433,12 @@ class qformat_hotpot extends qformat_default {
                             $fraction = 1;
                         }
                     }
-                    $question->fraction[] = $fraction;
-                    $question->feedback[] = $this->hotpot_prepare_str($xml->xml_value($tags, $answer."['feedback'][0]['#']"));
-                    $question->answer[] = $this->hotpot_prepare_str($xml->xml_value($tags, $answer."['text'][0]['#']"));
+                    $answertext = $this->hotpot_prepare_str($xml->xml_value($tags, $answer."['text'][0]['#']"));
+                    if ($answertext!='') {
+                        $question->answer[] = $answertext;
+                        $question->fraction[] = $fraction;
+                        $question->feedback[] = $this->hotpot_prepare_str($xml->xml_value($tags, $answer."['feedback'][0]['#']"));
+                    }
                     $a++;
                 }
                 $questions[] = $question;