MDL-79507 quiz: Hide version info when rendering blocked questions

This commit is contained in:
Mark Johnson 2023-09-29 09:31:36 +01:00
parent c6e727732a
commit f462a48202
2 changed files with 25 additions and 3 deletions

View File

@ -1294,6 +1294,7 @@ class quiz_attempt {
$displayoptions->manualcomment = question_display_options::HIDDEN;
$displayoptions->history = question_display_options::HIDDEN;
$displayoptions->readonly = true;
$displayoptions->versioninfo = question_display_options::HIDDEN;
return html_writer::div($placeholderqa->render($displayoptions,
$this->get_question_number($this->get_original_slot($slot))),

View File

@ -13,9 +13,9 @@ Feature: Attempt a quiz where some questions require that the previous question
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| student | C1 | student |
| teacher | C1 | teacher |
| user | course | role |
| student | C1 | student |
| teacher | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
@ -48,6 +48,27 @@ Feature: Attempt a quiz where some questions require that the previous question
And "Question 1" "link" should exist
And "Question 2" "link" should not exist
@javascript
Scenario: A question is shown as blocked when previewing a quiz
Given the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Test questions | truefalse | TF1 | First question |
| Test questions | truefalse | TF2 | Second question |
And the following "activities" exist:
| activity | name | intro | course | idnumber | preferredbehaviour |
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback |
And quiz "Quiz 1" contains the following questions:
| question | page | requireprevious |
| TF1 | 1 | 0 |
| TF2 | 1 | 1 |
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher"
And I press "Preview quiz"
Then I should see "First question"
And I should see "This question cannot be attempted until the previous question has been completed."
And I should not see "Second question"
@javascript
Scenario: A question requires the previous one becomes available when the first one is answered
Given the following "questions" exist: