From ab1e7c397fdfb85f7db877658be2bb09e3081281 Mon Sep 17 00:00:00 2001 From: mark-nielsen Date: Tue, 17 Mar 2009 16:27:40 +0000 Subject: [PATCH] shortanswer grading: MDL-18347 shortanswer was not grading correctly with custom scoring set to No, merged from 19 --- mod/lesson/action/continue.php | 2 +- mod/lesson/locallib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/lesson/action/continue.php b/mod/lesson/action/continue.php index 5d03ac63ee..d9ae2a88c2 100644 --- a/mod/lesson/action/continue.php +++ b/mod/lesson/action/continue.php @@ -122,7 +122,7 @@ $expectedanswer = str_replace('#####', '.*', $expectedanswer); } // see if user typed in any of the correct answers - if (lesson_iscorrect($pageid, $answer->jumpto) and ($lesson->custom && $answer->score > 0) ) { + if ((!$lesson->custom && lesson_iscorrect($pageid, $answer->jumpto)) or ($lesson->custom && $answer->score > 0) ) { if (!$useregexp) { // we are using 'normal analysis', which ignores case if (preg_match('/^'.$expectedanswer.'$/i',$useranswer)) { $ismatch = true; diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index 5dae74c0d2..c5b714d52a 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -1472,7 +1472,7 @@ function lesson_grade($lesson, $ntries, $userid = 0) { $earned += $essayinfo->score; $nmanual++; $manualpoints += $answers[$attempt->answerid]->score; - } else { + } else if (!empty($attempt->answerid)) { $earned += $answers[$attempt->answerid]->score; } } else { -- 2.39.5