mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-77656 quiz: Don't use custom question numbers from shuffled sections
This commit is contained in:
parent
24bbb18eb2
commit
3bea326d7a
@ -82,6 +82,7 @@ abstract class navigation_panel_base {
|
||||
|
||||
$button = new navigation_question_button();
|
||||
$button->id = 'quiznavbutton' . $slot;
|
||||
$button->isrealquestion = $this->attemptobj->is_real_question($slot);
|
||||
$button->number = $this->attemptobj->get_question_number($slot);
|
||||
$button->stateclass = $qa->get_state_class($showcorrectness);
|
||||
$button->navmethod = $this->attemptobj->get_navigation_method();
|
||||
|
@ -30,6 +30,8 @@ use renderable;
|
||||
class navigation_question_button implements renderable {
|
||||
/** @var string id="..." to add to the HTML for this button. */
|
||||
public $id;
|
||||
/** @var bool, if this is a real question, not an info item. */
|
||||
public $isrealquestion;
|
||||
/** @var string number to display in this button. Either the question number of 'i'. */
|
||||
public $number;
|
||||
/** @var string class to add to the class="" attribute to represnt the question state. */
|
||||
|
@ -380,7 +380,7 @@ class renderer extends plugin_renderer_base {
|
||||
}
|
||||
$extrainfo[] = html_writer::tag('span', $flaglabel, ['class' => 'flagstate']);
|
||||
|
||||
if (is_numeric($button->number)) {
|
||||
if ($button->isrealquestion) {
|
||||
$qnostring = 'questionnonav';
|
||||
} else {
|
||||
$qnostring = 'questionnonavinfo';
|
||||
|
@ -255,7 +255,8 @@ class quiz_attempt {
|
||||
foreach ($slots as $slot) {
|
||||
if ($length = $this->is_real_question($slot)) {
|
||||
// Whether question numbering is customised or is numeric and automatically incremented.
|
||||
if (!empty($this->slots[$slot]->displaynumber) && !is_null($this->slots[$slot]->displaynumber)) {
|
||||
if ($this->slots[$slot]->displaynumber !== null && $this->slots[$slot]->displaynumber !== '' &&
|
||||
!$this->slots[$slot]->section->shufflequestions) {
|
||||
$this->questionnumbers[$slot] = $this->slots[$slot]->displaynumber;
|
||||
} else {
|
||||
$this->questionnumbers[$slot] = (string) $number;
|
||||
|
@ -67,6 +67,24 @@ Feature: Editing question numbering of the existing questions already in a quiz
|
||||
And I should see "Question 3"
|
||||
And I should see "Question 4"
|
||||
|
||||
Scenario: Customised numbers are not used in shuffled sections, even if they exist in the database
|
||||
Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
||||
And I set the field "Shuffle" to "1"
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page
|
||||
And I press "Preview quiz"
|
||||
Then I should see "Section 1" in the "Quiz navigation" "block"
|
||||
And I should see question "1" in section "Section 1" in the quiz navigation
|
||||
And I should see question "2" in section "Section 1" in the quiz navigation
|
||||
And I should see "Section 2" in the "Quiz navigation" "block"
|
||||
And I should see question "3" in section "Section 2" in the quiz navigation
|
||||
And I should see question "4" in section "Section 2" in the quiz navigation
|
||||
|
||||
And I should see "Question 1"
|
||||
And I should see "Question 2"
|
||||
And I press "Next page"
|
||||
And I should see "Question 3"
|
||||
And I should see "Question 4"
|
||||
|
||||
Scenario: Showing long customised question numbers on quiz editing page and parcially hidden on question info and navigation.
|
||||
Given quiz "Quiz 2" contains the following questions:
|
||||
| question | page | displaynumber |
|
||||
|
Loading…
x
Reference in New Issue
Block a user