From 846e242aec05a6f528e784c39eb40b5f6e534ef2 Mon Sep 17 00:00:00 2001 From: Vithusha Kethiri Date: Mon, 26 Aug 2024 11:08:37 +1000 Subject: [PATCH] MDL-82875 qbank_export: Fix removing hidden questions from the export --- question/format.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/question/format.php b/question/format.php index 0be6f752c71fe..a24d9e9d9d7e7 100644 --- a/question/format.php +++ b/question/format.php @@ -960,17 +960,18 @@ public function exportprocess($checkcapabilities = true) { $contextid = $DB->get_field('question_categories', 'contextid', ['id' => $qcategory]); $question->contextid = $contextid; $question->idnumber = $questionbankentry->idnumber; + + // Do not export hidden questions. + if ($question->status === \core_question\local\bank\question_version_status::QUESTION_STATUS_HIDDEN) { + continue; + } + if ($question->status === \core_question\local\bank\question_version_status::QUESTION_STATUS_READY) { $question->status = 0; } else { $question->status = 1; } - // do not export hidden questions - if (!empty($question->hidden)) { - continue; - } - // do not export random questions if ($question->qtype == 'random') { continue;