Permalink
Browse files

MDL-26788 - grading in lesson containing essays

  • Loading branch information...
1 parent 7daba27 commit e0be8fd6a3b03c4090d7a3d89a137ccba6c2aaac Rossiani Wijaya committed Apr 29, 2011
Showing with 7 additions and 2 deletions.
  1. +3 −1 mod/lesson/essay.php
  2. +4 −1 mod/lesson/locallib.php
View
@@ -76,6 +76,8 @@
}
$attemptid = required_param('attemptid', PARAM_INT);
+ $score = optional_param('score', 0, PARAM_INT);
+
if (!$attempt = $DB->get_record('lesson_attempts', array('id' => $attemptid))) {
print_error('cannotfindattempt', 'lesson');
}
@@ -87,7 +89,7 @@
$essayinfo = unserialize($attempt->useranswer);
$essayinfo->graded = 1;
- $essayinfo->score = clean_param($form->score, PARAM_INT);
+ $essayinfo->score = $score;
$essayinfo->response = clean_param($form->response, PARAM_RAW);
$essayinfo->sent = 0;
if (!$lesson->custom && $essayinfo->score == 1) {
View
@@ -318,7 +318,10 @@ function lesson_grade($lesson, $ntries, $userid = 0) {
$attempt = end($attempts);
// If essay question, handle it, otherwise add to score
if ($page->requires_manual_grading()) {
- $earned += $page->earned_score($answers, $attempt);
+ $useranswerobj = unserialize($attempt->useranswer);
+ if (isset($useranswerobj->score)) {
+ $earned += $useranswerobj->score;
+ }
$nmanual++;
$manualpoints += $answers[$attempt->answerid]->score;
} else if (!empty($attempt->answerid)) {

0 comments on commit e0be8fd

Please sign in to comment.