Skip to content

Commit

Permalink
Merge branch 'MDL-26788_m20' of git://github.com/rwijaya/moodle into …
Browse files Browse the repository at this point in the history
…MOODLE_20_STABLE
  • Loading branch information
stronk7 committed May 4, 2011
2 parents 5d6eafc + e0be8fd commit 78cc7be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mod/lesson/essay.php
Expand Up @@ -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');
}
Expand All @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion mod/lesson/locallib.php
Expand Up @@ -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)) {
Expand Down

0 comments on commit 78cc7be

Please sign in to comment.