Merge branch 'MDL-85200_main' of https://github.com/marxjohnson/moodle into main

This commit is contained in:
Mihail Geshoski
2025-07-05 20:16:38 +08:00
3 changed files with 14 additions and 7 deletions
+12 -6
View File
@@ -1853,12 +1853,18 @@ class structure {
private function populate_question_sources(): void {
global $DB;
$sql = 'SELECT c.id AS contextid, cm.id, cm.course
FROM {question_categories} qc
JOIN {context} c ON c.id = qc.contextid
JOIN {course_modules} cm ON cm.id = c.instanceid AND c.contextlevel = ' . CONTEXT_MODULE . '
GROUP BY c.id, cm.id, cm.course';
$this->questionsources = $DB->get_records_sql($sql);
$contextids = array_map(fn($question) => $question->contextid, $this->questions);
[$insql, $inparams] = $DB->get_in_or_equal(array_unique($contextids));
$sql = "
SELECT c.id as contextid, cm.id, cm.course
FROM {context} c
JOIN {course_modules} cm ON cm.id = c.instanceid AND c.contextlevel = ?
WHERE c.id {$insql}
";
$params = array_merge([context_module::LEVEL], $inparams);
$this->questionsources = $DB->get_records_sql($sql, $params);
}
/**
+1 -1
View File
@@ -58,7 +58,7 @@
{{#issharedbank}}
<div class="sharedbank">
<a href="{{bankurl}}">
<span class="badge bg-primary text-light ms-2 mt-1">{{bankname}}</span>
<span class="badge bg-primary text-light ms-2 mt-1">{{{bankname}}}</span>
</a>
</div>
{{/issharedbank}}
@@ -178,6 +178,7 @@ Feature: Adding questions to a quiz from the question bank
And I click on "Select" "checkbox" in the "question 03 name" "table_row"
And I click on "Add selected questions to the quiz" "button"
And I should see "question 03 name"
And "Qbank 1 & < > " "text" should appear after "question 03 name" "text"
@javascript
Scenario: Validate the sorting while adding questions from question bank