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:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user