Merge branch 'MDL-83832-master' of https://github.com/NashTechOpenUniversity/moodle
This commit is contained in:
@@ -83,6 +83,7 @@ class preview_view extends view {
|
||||
'modifierfirstname' => 'Admin',
|
||||
'modifierlastname' => 'User',
|
||||
'timemodified' => 1691157311,
|
||||
'isdummy' => true,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
namespace qbank_history;
|
||||
|
||||
use core_question\local\bank\filter_condition_manager;
|
||||
use core_question\local\bank\question_action_base;
|
||||
|
||||
/**
|
||||
@@ -49,11 +50,20 @@ class history_action extends question_action_base {
|
||||
}
|
||||
|
||||
if (question_has_capability_on($question, 'use')) {
|
||||
$currentfilter = $this->qbank->base_url()->param('filter');
|
||||
if ($currentfilter) {
|
||||
$currentfilter = filter_condition_manager::update_filter_param_to_category(
|
||||
$currentfilter, $question->categoryid);
|
||||
} else if (empty($question->isdummy)) {
|
||||
$currentfilter = json_encode(filter_condition_manager::get_default_filter(
|
||||
$question->categoryid . ',' . $question->contextid));
|
||||
}
|
||||
|
||||
$url = helper::get_question_history_url(
|
||||
$question->questionbankentryid,
|
||||
$this->qbank->returnurl,
|
||||
$this->qbank->cm->id,
|
||||
$this->qbank->base_url()->param('filter'),
|
||||
$currentfilter,
|
||||
);
|
||||
return [$url, 't/log', $this->strpreview];
|
||||
}
|
||||
|
||||
@@ -55,6 +55,29 @@ Feature: Use the qbank plugin manager page for question history
|
||||
And I should see "Second question"
|
||||
And "Second question" "table_row" should exist
|
||||
|
||||
Scenario: Viewing history for a Question in a Subcategory
|
||||
Given the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Activity module | quiz1 | Questions Category 1 |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name | questioncategory |
|
||||
| Activity module | quiz1 | Subcategory 1 | Questions Category 1 |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Subcategory 1 | truefalse | First question (v1) | Question version 1 |
|
||||
When I am on the "Test quiz" "mod_quiz > question categories" page logged in as "admin"
|
||||
And I should see "Subcategory 1"
|
||||
And I click on "Subcategory 1" "link"
|
||||
Then I should see "First question (v1)"
|
||||
And I choose "Edit question" action for "First question (v1)" in the question bank
|
||||
And I set the following fields to these values:
|
||||
| Question name | First question (v2) |
|
||||
| Question text | Question version 2 |
|
||||
And I press "id_submitbutton"
|
||||
And I choose "History" action for "First question (v2)" in the question bank
|
||||
And "First question (v1)" "table_row" should exist
|
||||
And "First question (v2)" "table_row" should exist
|
||||
|
||||
@javascript
|
||||
Scenario: Delete question from the history using Edit question menu
|
||||
Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "admin"
|
||||
|
||||
Reference in New Issue
Block a user