mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Fixed a NASTY little bug that sometimes occurred when
re-grading quizzes with random questions in them. (everyone got set to zero)
This commit is contained in:
parent
543e1c58b5
commit
0a660b03e0
@ -363,8 +363,16 @@ function quiz_get_attempt_responses($attempt) {
|
|||||||
foreach ($responses as $key => $response) {
|
foreach ($responses as $key => $response) {
|
||||||
if ($response->qtype == RANDOM) {
|
if ($response->qtype == RANDOM) {
|
||||||
$responses[$key]->random = $response->answer;
|
$responses[$key]->random = $response->answer;
|
||||||
$responses[$key]->answer = explode(",",$responses[$response->answer]->answer);
|
|
||||||
$responses[$response->answer]->delete = true;
|
$responses[$response->answer]->delete = true;
|
||||||
|
|
||||||
|
$realanswer = $responses[$response->answer]->answer;
|
||||||
|
|
||||||
|
if (is_array($realanswer)) {
|
||||||
|
$responses[$key]->answer = $realanswer;
|
||||||
|
} else {
|
||||||
|
$responses[$key]->answer = explode(",", $realanswer);
|
||||||
|
}
|
||||||
|
|
||||||
} else if ($response->qtype == NUMERICAL or $response->qtype == SHORTANSWER) {
|
} else if ($response->qtype == NUMERICAL or $response->qtype == SHORTANSWER) {
|
||||||
$responses[$key]->answer = array($response->answer);
|
$responses[$key]->answer = array($response->answer);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user