Skip to content

Commit

Permalink
MDL-30867 Lesson module: fix lesson essay question formtting to be co…
Browse files Browse the repository at this point in the history
…nsistent with user selection
  • Loading branch information
Rossiani Wijaya committed Mar 9, 2012
1 parent f24a1a7 commit 8af9ec6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mod/lesson/essay.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@
$data->id = $cm->id;
$data->attemptid = $attemptid;
$data->score = $essayinfo->score;
$data->studentanswer = format_string($essayinfo->answer, FORMAT_MOODLE);
$data->studentanswer = format_string($essayinfo->answer, $essayinfo->answerformat);
$data->response = $essayinfo->response;
$mform->set_data($data);

Expand Down
7 changes: 5 additions & 2 deletions mod/lesson/pagetypes/essay.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ public function check_answer() {

if (is_array($data->answer)) {
$studentanswer = $data->answer['text'];
$studentanswerformat = $data->answer['format'];
} else {
$studentanswer = $data->answer;
$studentanswerformat = FORMAT_MOODLE;
}

if (trim($studentanswer) === '') {
Expand All @@ -117,9 +119,10 @@ public function check_answer() {
$userresponse->graded = 0;
$userresponse->score = 0;
$userresponse->answer = $studentanswer;
$userresponse->answerformat = $studentanswerformat;
$userresponse->response = "";
$result->userresponse = serialize($userresponse);

$result->studentanswerformat = $studentanswerformat;
$result->studentanswer = s($studentanswer);
return $result;
}
Expand Down Expand Up @@ -220,7 +223,7 @@ public function report_answers($answerpage, $answerdata, $useranswer, $pagestats
// dont think this should ever be reached....
$avescore = get_string("nooneansweredthisquestion", "lesson");
}
$answerdata->answers[] = array(format_text($essayinfo->answer, FORMAT_MOODLE, $formattextdefoptions), $avescore);
$answerdata->answers[] = array(format_text($essayinfo->answer, $essayinfo->answerformat, $formattextdefoptions), $avescore);
$answerpage->answerdata = $answerdata;
}
return $answerpage;
Expand Down

0 comments on commit 8af9ec6

Please sign in to comment.