mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-39488: Lesson Module: Fixed the potential variable overwritting for answers
This commit is contained in:
parent
3b3e7fd11c
commit
89aa433fbd
1 changed files with 6 additions and 5 deletions
|
@ -161,16 +161,17 @@ class lesson_page_type_matching extends lesson_page {
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $data->response;
|
$response = $data->response;
|
||||||
$answers = $this->get_answers();
|
$getanswers = $this->get_answers();
|
||||||
|
|
||||||
$correct = array_shift($answers);
|
$correct = array_shift($getanswers);
|
||||||
$wrong = array_shift($answers);
|
$wrong = array_shift($getanswers);
|
||||||
|
|
||||||
foreach ($answers as $key=>$answer) {
|
$answers = array();
|
||||||
|
foreach ($getanswers as $key=>$answer) {
|
||||||
if ($answer->answer !== '' or $answer->response !== '') {
|
if ($answer->answer !== '' or $answer->response !== '') {
|
||||||
$answers[$answer->id] = $answer;
|
$answers[$answer->id] = $answer;
|
||||||
}
|
}
|
||||||
unset($answers[$key]);
|
unset($getanswers[$key]);
|
||||||
}
|
}
|
||||||
// get the user's exact responses for record keeping
|
// get the user's exact responses for record keeping
|
||||||
$hits = 0;
|
$hits = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue