matching qtype: MDL-17981 extra distractors feature was not working on MS SQL server, since MDL-14420 was fixed.

This commit is contained in:
tjhunt
2009-01-23 02:19:30 +00:00
parent cbe2a956eb
commit bcda961144
+6 -6
View File
@@ -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;