diff --git a/mod/quiz/db/mysql.php b/mod/quiz/db/mysql.php index ac46c56e080..721771a9a71 100644 --- a/mod/quiz/db/mysql.php +++ b/mod/quiz/db/mysql.php @@ -1035,6 +1035,11 @@ function quiz_upgrade($oldversion) { } } + if ($oldversion < 2006043000) { + // The newgraded field must always point to a valid state + modify_database("","UPDATE prefix_question_sessions SET newgraded = newest where newgraded = '0'"); + } + return true; } diff --git a/mod/quiz/db/postgres7.php b/mod/quiz/db/postgres7.php index 4290ed57aab..2b217c8f1eb 100644 --- a/mod/quiz/db/postgres7.php +++ b/mod/quiz/db/postgres7.php @@ -1206,6 +1206,11 @@ function quiz_upgrade($oldversion) { } } + if ($oldversion < 2006043000) { + // The newgraded field must always point to a valid state + modify_database("","UPDATE prefix_question_sessions SET newgraded = newest where newgraded = '0'"); + } + return true; }