Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixing bug where quizzes from 1.4 will lose their answers when upgrad…

…ed to later versions.

Fixes MDL-8207.
  • Loading branch information...
commit 8b4a8f616f97becd77c29f2f5b8129cf3d3fbb81 1 parent f470cf4
mchurch authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 mod/quiz/locallib.php
4 mod/quiz/locallib.php
@@ -575,11 +575,11 @@ function quiz_upgrade_states($attempt) {
// Actually we only do this for states whose question is actually listed in $attempt->layout.
// We do not do it for states associated to wrapped questions like for example the questions
// used by a RANDOM question
- $newest->attemptid = $attempt->uniqueid;
+ $session = new stdClass;
+ $session->attemptid = $attempt->uniqueid;
$questionlist = quiz_questions_in_quiz($attempt->layout);
if ($questionlist and $states = get_records_select('question_states', "attempt = '$attempt->uniqueid' AND question IN ($questionlist)")) {
foreach ($states as $state) {
- $session = new stdClass;
$session->newgraded = $state->id;
$session->newest = $state->id;
$session->questionid = $state->question;
Please sign in to comment.
Something went wrong with that request. Please try again.