This commit is contained in:
Huong Nguyen
2025-01-21 08:57:46 +07:00
2 changed files with 26 additions and 11 deletions
+2 -11
View File
@@ -1104,19 +1104,10 @@ class edit_renderer extends \plugin_renderer_base {
$editicon = $this->pix_icon('t/edit', $configuretitle, 'moodle', ['title' => '']);
$qbankurlparams = [
'cmid' => $structure->get_cmid(),
'cat' => $slot->category . ',' . $slot->contextid,
'cmid' => $structure->get_source_bank($slotnumber)->cminfo->id,
'filter' => json_encode($slot->filtercondition['filter']),
];
$slottags = [];
if (isset($slot->randomtags)) {
$slottags = $slot->randomtags;
}
foreach ($slottags as $index => $slottag) {
$slottag = explode(',', $slottag);
$qbankurlparams["qtagids[{$index}]"] = $slottag[0];
}
// If this is a random question, display a link to show the questions
// selected from in the question bank.
$qbankurl = new \moodle_url('/question/edit.php', $qbankurlparams);
@@ -212,3 +212,27 @@ Feature: Adding random questions to a quiz based on category and tags
And I should see "Random (New Random category) based on filter condition" on quiz page "1"
And I click on "Configure question" "link" in the "Random (New Random category) based on filter condition" "list_item"
Then I should see "New Random category"
Scenario: See questions link applies all random question filters
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
And I open the "last" add to quiz menu
And I follow "a random question"
And I apply question bank filter "Tag" with value "foo"
And I select "1" from the "randomcount" singleselect
And I press "Add random question"
And I should see "Random (Questions Category 1) based on filter condition with tags: foo" on quiz page "1"
And I click on "Configure question" "link" in the "Random (Questions Category 1) based on filter condition with tags: foo" "list_item"
And I should see "Questions Category 1"
And I should see "foo"
And I should see "question 1 name"
And I should see "\"listen\" & \"answer\""
And I should not see "bar"
And I should not see "question 2 name"
When I am on the "Quiz 1" "mod_quiz > Edit" page
And I click on "(See questions)" "link" in the "Random (Questions Category 1) based on filter condition with tags: foo" "list_item"
Then I should see "Questions Category 1"
And I should see "foo"
And I should see "question 1 name"
And I should see "\"listen\" & \"answer\""
And I should not see "bar"
And I should not see "question 2 name"