From: tjhunt Date: Fri, 23 Jan 2009 02:19:30 +0000 (+0000) Subject: matching qtype: MDL-17981 extra distractors feature was not working on MS SQL server... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=bcda961144ce832a8b347424dd7b6ddf39ad2f1c;p=moodle.git matching qtype: MDL-17981 extra distractors feature was not working on MS SQL server, since MDL-14420 was fixed. --- diff --git a/question/type/match/questiontype.php b/question/type/match/questiontype.php index 12c47b456f..68340237fd 100644 --- a/question/type/match/questiontype.php +++ b/question/type/match/questiontype.php @@ -200,11 +200,11 @@ class question_match_qtype extends default_questiontype { $responses = array(); foreach ($subquestions as $key => $subquestion) { $response = 0; - if ($subquestion->questiontext !== '') { + if ($subquestion->questiontext !== '' && !is_null($subquestion->questiontext)) { if ($state->responses[$key]) { $response = $state->responses[$key]; if (!array_key_exists($response, $subquestion->options->answers)) { - // If studen's answer did not match by id, but there may be + // If student's answer did not match by id, but there may be // two answers with the same text, but different ids, // so we need to try matching the answer text. $expected_answer = reset($subquestion->options->answers); @@ -230,7 +230,7 @@ class question_match_qtype extends default_questiontype { $responses = array(); foreach ($state->options->subquestions as $sub) { foreach ($sub->options->answers as $answer) { - if (1 == $answer->fraction && $sub->questiontext != '') { + if (1 == $answer->fraction && $sub->questiontext != '' && !is_null($sub->questiontext)) { $responses[$sub->id] = $answer->id; } } @@ -279,7 +279,7 @@ class question_match_qtype extends default_questiontype { // Print the input controls foreach ($subquestions as $key => $subquestion) { - if ($subquestion->questiontext !== '') { + if ($subquestion->questiontext !== '' && !is_null($subquestion->questiontext)) { // Subquestion text: $a = new stdClass; $a->text = $this->format_text($subquestion->questiontext, @@ -341,7 +341,7 @@ class question_match_qtype extends default_questiontype { $sumgrade = 0; $totalgrade = 0; foreach ($subquestions as $key => $sub) { - if ($sub->questiontext !== '') { + if ($sub->questiontext !== '' && !is_null($sub->questiontext)) { $totalgrade += 1; $response = $responses[$key]; if ($response && !array_key_exists($response, $sub->options->answers)) { @@ -393,7 +393,7 @@ class question_match_qtype extends default_questiontype { $answers = array(); if (is_array($question->options->subquestions)) { foreach ($question->options->subquestions as $aid => $answer) { - if ($answer->questiontext) { + if ($answer->questiontext !== '' && !is_null($answer->questiontext)) { $r = new stdClass; $r->answer = $answer->questiontext . ": " . $answer->answertext; $r->credit = 1;