Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

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 7c4b621a2051fc5bdc769f2372a468411e65150e 1 parent ab6803a
mchurch authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 mod/quiz/locallib.php
4 mod/quiz/locallib.php
@@ -587,11 +587,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.