]> git.mjollnir.org Git - moodle.git/commitdiff
shortanswer grading: MDL-18347 shortanswer was not grading correctly with custom...
authormark-nielsen <mark-nielsen>
Tue, 17 Mar 2009 16:27:40 +0000 (16:27 +0000)
committermark-nielsen <mark-nielsen>
Tue, 17 Mar 2009 16:27:40 +0000 (16:27 +0000)
mod/lesson/action/continue.php
mod/lesson/locallib.php

index 5d03ac63eef45bac28e064330201757feab84359..d9ae2a88c20380fe2225c029328da5958347dfc3 100644 (file)
                     $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;
index 5dae74c0d257b858a0b0429e372c3dc845bcb41a..c5b714d52acfba9628468807aa5d8f17b5c0c27d 100644 (file)
@@ -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 {