]> git.mjollnir.org Git - moodle.git/commitdiff
Removed notices caused by empty responses
authorgustav_delius <gustav_delius>
Mon, 27 Mar 2006 08:38:55 +0000 (08:38 +0000)
committergustav_delius <gustav_delius>
Mon, 27 Mar 2006 08:38:55 +0000 (08:38 +0000)
question/type/match/questiontype.php
question/type/multichoice/questiontype.php

index 3205eae761d4f4b106b9a1630d8266ec5789100b..9596b522248eb313c22e91a30ab7969019b5e471 100644 (file)
@@ -326,7 +326,7 @@ class question_match_qtype extends default_questiontype {
         if (isset($state->responses)) {
             foreach($state->responses as $left=>$right){
                 $lpair = $question->options->subquestions[$left]->questiontext;
-                $rpair = $question->options->subquestions[$right]->answertext;
+                $rpair = $right ? $question->options->subquestions[$right]->answertext : '';
                 $results[$left] = $lpair." : ".$rpair;
             }
             return $results;
index ae4b18c2817a6a84674cf7f7337ec77efb37413e..99d2bc6969cb37ebceab440cc006e2459f14d558 100644 (file)
@@ -362,7 +362,7 @@ class question_multichoice_qtype extends default_questiontype {
         $answers = $question->options->answers;
         if (!empty($state->responses)) {
             foreach ($state->responses as $aid =>$rid){
-                $answer = $answers[$rid]->answer;
+                $answer = $rid ? $answers[$rid]->answer : '';
                 $responses[] = $answer;
             }
         } else {