Skip to content

Commit

Permalink
MDL-82875 qbank_export: Fix removing hidden questions from the export
Browse files Browse the repository at this point in the history
  • Loading branch information
Vithusha Kethiri authored and timhunt committed Sep 13, 2024
1 parent f86b97f commit 846e242
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions question/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 846e242

Please sign in to comment.