Skip to content
Browse files

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

…MOODLE_20_STABLE
  • Loading branch information...
2 parents 5d6eafc + e0be8fd commit 78cc7bee627083be73ec69e82e76fc4793d2cbaa @stronk7 stronk7 committed May 4, 2011
Showing with 7 additions and 2 deletions.
  1. +3 −1 mod/lesson/essay.php
  2. +4 −1 mod/lesson/locallib.php
View
4 mod/lesson/essay.php
@@ -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
5 mod/lesson/locallib.php
@@ -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 78cc7be

Please sign in to comment.
Something went wrong with that request. Please try again.