From 987e0e915c0fcdbfb88d208ba8882770e6a1a75e Mon Sep 17 00:00:00 2001 From: Henning Bostelmann Date: Tue, 9 Aug 2011 17:24:09 +0100 Subject: [PATCH] MDL-28686 QE2 upgrade: recognize manually graded, deleted questions --- question/engine/upgrade/upgradelib.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/question/engine/upgrade/upgradelib.php b/question/engine/upgrade/upgradelib.php index 5ba8e1c93fa..6f0aac88c08 100644 --- a/question/engine/upgrade/upgradelib.php +++ b/question/engine/upgrade/upgradelib.php @@ -342,6 +342,15 @@ class question_engine_attempt_upgrader { } protected function get_converter_class_name($question, $quiz, $qsessionid) { + global $DB; + if ($question->qtype == 'deleted') { + $where = '(question = :questionid OR '.$DB->sql_like('answer', ':randomid').') AND event = 7'; + $params = array('questionid'=>$question->id, 'randomid'=>"random{$question->id}-%"); + if ($DB->record_exists_select('question_states', $where, $params)) { + $this->logger->log_assumption("Assuming that deleted question {$question->id} was manually graded."); + return 'qbehaviour_manualgraded_converter'; + } + } if ($question->qtype == 'essay') { return 'qbehaviour_manualgraded_converter'; } else if ($question->qtype == 'description') { -- 2.43.0