Skip to content

Commit 270cebf

Browse files
jason-plattsJason.Platts
andauthored
Auto numbers always on view all responses #605 (#606)
Co-authored-by: Jason.Platts <[email protected]>
1 parent dd66418 commit 270cebf

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

questionnaire.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2916,11 +2916,11 @@ public function survey_results($rid = '', $uid=false, $pdf = false, $currentgrou
29162916
}
29172917
if (!$pdf) {
29182918
$this->page->add_to_page('responses', $this->renderer->container_start('qn-container'));
2919-
$this->page->add_to_page('responses', $this->renderer->container_start('qn-info'));
2920-
if ($question->is_numbered()) {
2919+
if ($this->questions_autonumbered() && $question->is_numbered()) {
2920+
$this->page->add_to_page('responses', $this->renderer->container_start('qn-info'));
29212921
$this->page->add_to_page('responses', $this->renderer->heading($qnum, 2, 'qn-number'));
2922+
$this->page->add_to_page('responses', $this->renderer->container_end()); // End qn-info.
29222923
}
2923-
$this->page->add_to_page('responses', $this->renderer->container_end()); // End qn-info.
29242924
$this->page->add_to_page('responses', $this->renderer->container_start('qn-content'));
29252925
}
29262926
// If question text is "empty", i.e. 2 non-breaking spaces were inserted, do not display any question text.
@@ -2929,7 +2929,7 @@ public function survey_results($rid = '', $uid=false, $pdf = false, $currentgrou
29292929
}
29302930
if ($pdf) {
29312931
$response = new stdClass();
2932-
if ($question->is_numbered()) {
2932+
if ($this->questions_autonumbered() && $question->is_numbered()) {
29332933
$response->qnum = $qnum;
29342934
}
29352935
$response->qcontent = format_text(file_rewrite_pluginfile_urls($question->content, 'pluginfile.php',

tests/behat/check_responses.feature

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,28 @@ Feature: Review responses
121121
And I follow "Test questionnaire"
122122
And I navigate to "View all responses" in current page administration
123123
Then "//b[text()='One']" "xpath_element" should exist
124+
125+
Scenario: Check auto numbering setting in responses
126+
Given the following "courses" exist:
127+
| fullname | shortname | category |
128+
| Course 1 | C1 | 0 |
129+
And the following "activities" exist:
130+
| activity | name | description | course | idnumber |
131+
| questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 |
132+
And "Test questionnaire" has questions and responses
133+
And I am on the "Course 1" "Course" page logged in as "admin"
134+
And I follow "Test questionnaire"
135+
When I navigate to "View all responses" in current page administration
136+
Then ".qn-number" "css_element" should exist
137+
Given I follow "List of responses"
138+
When I follow "Admin User"
139+
Then ".qn-number" "css_element" should exist
140+
# Check auto numbering not show in response when turned off.
141+
Given I navigate to "Settings" in current page administration
142+
And I set the field "Auto numbering" to "Do not number questions or pages"
143+
And I press "Save and display"
144+
When I navigate to "View all responses" in current page administration
145+
Then ".qn-number" "css_element" should not exist
146+
Given I follow "List of responses"
147+
When I follow "Admin User"
148+
Then ".qn-number" "css_element" should not exist

0 commit comments

Comments
 (0)