Permalink
Browse files

Merge branch 'MDL-39488_m23' of git://github.com/rwijaya/moodle into …

…MOODLE_23_STABLE
  • Loading branch information...
2 parents be6281e + b26066b commit 6185fa79e7d3730e09f29da70d58ee0ca3ac1d8b @stronk7 stronk7 committed May 9, 2013
Showing with 7 additions and 8 deletions.
  1. +1 −1 mod/lesson/lang/en/lesson.php
  2. +6 −7 mod/lesson/pagetypes/matching.php
@@ -280,7 +280,7 @@
$string['namereject'] = 'Sorry, your name has been rejected by the filter.<br />Please try another name.';
$string['new'] = 'new';
$string['nextpage'] = 'Next page';
-$string['noanswer'] = 'No answer given. Please go back and submit an answer.';
+$string['noanswer'] = 'One or more questions have no answer given. Please go back and submit an answer.';
$string['noattemptrecordsfound'] = 'No attempt records found: no grade given';
$string['nobranchtablefound'] = 'No content page found';
$string['nocommentyet'] = 'No comment yet.';
@@ -161,11 +161,6 @@ public function check_answer() {
}
$response = $data->response;
- if (!is_array($response)) {
- $result->noanswer = true;
- return $result;
- }
-
$answers = $this->get_answers();
$correct = array_shift($answers);
@@ -177,12 +172,16 @@ public function check_answer() {
}
unset($answers[$key]);
}
- // get he users exact responses for record keeping
+ // get the user's exact responses for record keeping
$hits = 0;
$userresponse = array();
foreach ($response as $id => $value) {
+ if ($value == '') {
+ $result->noanswer = true;
+ return $result;
+ }
$userresponse[] = $value;
- // Make sure the user's answer is exist in question's answer
+ // Make sure the user's answer exists in question's answer
if (array_key_exists($id, $answers)) {
$answer = $answers[$id];
$result->studentanswer .= '<br />'.format_text($answer->answer, $answer->answerformat, $formattextdefoptions).' = '.$answers[$value]->response;

0 comments on commit 6185fa7

Please sign in to comment.