From c0fe568e2c28bb7c52948279434181cd1749bd5d Mon Sep 17 00:00:00 2001 From: mark-nielsen Date: Sat, 29 Dec 2007 21:50:53 +0000 Subject: [PATCH] Merging fix for MDL-11900 from MOODLE_19_STABLE --- mod/lesson/action/continue.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mod/lesson/action/continue.php b/mod/lesson/action/continue.php index 3b5aa19dcf..05d6cb312e 100644 --- a/mod/lesson/action/continue.php +++ b/mod/lesson/action/continue.php @@ -237,6 +237,8 @@ $nhits = 0; $correctresponse = ''; $wrongresponse = ''; + $correctanswerid = 0; + $wronganswerid = 0; // store student's answers for displaying on feedback page foreach ($answers as $answer) { foreach ($useranswers as $key => $answerid) { @@ -263,6 +265,10 @@ // leave in its "raw" state - will converted into a proper page id later $correctpageid = $answer->jumpto; } + // save the answer id for scoring + if ($correctanswerid == 0) { + $correctanswerid = $answer->id; + } // ...also save any response from the correct answers... if (trim(strip_tags($answer->response))) { $correctresponse = $answer->response; @@ -273,6 +279,10 @@ // leave in its "raw" state - will converted into a proper page id later $wrongpageid = $answer->jumpto; } + // save the answer id for scoring + if ($wronganswerid == 0) { + $wronganswerid = $answer->id; + } // ...and from the incorrect ones, don't know which to use at this stage if (trim(strip_tags($answer->response))) { $wrongresponse = $answer->response; @@ -293,6 +303,10 @@ // leave in its "raw" state - will converted into a proper page id later $correctpageid = $answer->jumpto; } + // save the answer id for scoring + if ($correctanswerid == 0) { + $correctanswerid = $answer->id; + } // ...also save any response from the correct answers... if (trim(strip_tags($answer->response))) { $correctresponse = $answer->response; @@ -303,6 +317,10 @@ // leave in its "raw" state - will converted into a proper page id later $wrongpageid = $answer->jumpto; } + // save the answer id for scoring + if ($wronganswerid == 0) { + $wronganswerid = $answer->id; + } // ...and from the incorrect ones, don't know which to use at this stage if (trim(strip_tags($answer->response))) { $wrongresponse = $answer->response; @@ -314,9 +332,11 @@ $correctanswer = true; $response = $correctresponse; $newpageid = $correctpageid; + $answerid = $correctanswerid; } else { $response = $wrongresponse; $newpageid = $wrongpageid; + $answerid = $wronganswerid; } } else { // only one answer allowed -- 2.39.5