MDL-20636 make upgradehelper able to reset badly upgraded attempts

Obviously, these are the ones where it most important to be able to redo the upgrade.
This commit is contained in:
Tim Hunt
2011-05-19 20:27:12 +01:00
parent ffe4d23abd
commit 2db6fbad97
2 changed files with 6 additions and 2 deletions
+4 -1
View File
@@ -85,7 +85,7 @@ class local_qeupgradehelper_attempt_upgrader extends question_engine_attempt_upg
WHERE quiza.preview = 0
AND quiza.needsupgradetonewqe = 0
AND oldtimemodified.time >= newtimemodified.time
AND (newtimemodified.time IS NULL OR oldtimemodified.time >= newtimemodified.time)
AND quiza.quiz = :quizid", array('quizid' => $quiz->id));
}
@@ -123,6 +123,9 @@ class local_qeupgradehelper_attempt_upgrader extends question_engine_attempt_upg
foreach ($slotlayout as $slot) {
if (array_key_exists($slot, $slottoquestionid)) {
$oldlayout[] = $slottoquestionid[$slot];
} else if (in_array($slot, $questionids)) {
// OK there was probably a problem during the original upgrade.
$oldlayout[] = $slot;
} else {
$ok = false;
break;
+2 -1
View File
@@ -344,7 +344,8 @@ function local_qeupgradehelper_get_resettable_quiz($quizid) {
SUM(CASE WHEN quiza.needsupgradetonewqe = 0 AND
oldtimemodified.time IS NOT NULL THEN 1 ELSE 0 END) AS convertedattempts,
SUM(CASE WHEN quiza.needsupgradetonewqe = 0 AND
oldtimemodified.time >= newtimemodified.time THEN 1 ELSE 0 END) AS resettableattempts
newtimemodified.time IS NULL OR oldtimemodified.time >= newtimemodified.time
THEN 1 ELSE 0 END) AS resettableattempts
FROM {quiz_attempts} quiza
JOIN {quiz} quiz ON quiz.id = quiza.quiz