mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-26788 - grading in lesson containing essays (head)
This commit is contained in:
parent
b8df9414bd
commit
f672e3e920
@ -76,6 +76,8 @@ switch ($mode) {
|
||||
}
|
||||
|
||||
$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 @@ switch ($mode) {
|
||||
$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) {
|
||||
|
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user