Skip to content

Commit

Permalink
Auto numbers always on view all responses PoetOS#605
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason.Platts committed Sep 12, 2024
1 parent f2ffa46 commit 5c5491e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
8 changes: 4 additions & 4 deletions questionnaire.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2915,11 +2915,11 @@ public function survey_results($rid = '', $uid=false, $pdf = false, $currentgrou
}
if (!$pdf) {
$this->page->add_to_page('responses', $this->renderer->container_start('qn-container'));
$this->page->add_to_page('responses', $this->renderer->container_start('qn-info'));
if ($question->is_numbered()) {
if ($this->questions_autonumbered() && $question->is_numbered()) {
$this->page->add_to_page('responses', $this->renderer->container_start('qn-info'));
$this->page->add_to_page('responses', $this->renderer->heading($qnum, 2, 'qn-number'));
$this->page->add_to_page('responses', $this->renderer->container_end()); // End qn-info.
}
$this->page->add_to_page('responses', $this->renderer->container_end()); // End qn-info.
$this->page->add_to_page('responses', $this->renderer->container_start('qn-content'));
}
// If question text is "empty", i.e. 2 non-breaking spaces were inserted, do not display any question text.
Expand All @@ -2928,7 +2928,7 @@ public function survey_results($rid = '', $uid=false, $pdf = false, $currentgrou
}
if ($pdf) {
$response = new stdClass();
if ($question->is_numbered()) {
if ($this->questions_autonumbered() && $question->is_numbered()) {
$response->qnum = $qnum;
}
$response->qcontent = format_text(file_rewrite_pluginfile_urls($question->content, 'pluginfile.php',
Expand Down
26 changes: 26 additions & 0 deletions tests/behat/check_responses.feature
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,29 @@ Feature: Review responses
And I follow "Test questionnaire"
And I navigate to "View all responses" in current page administration
Then "//b[text()='One']" "xpath_element" should exist


Scenario: Check auto numbering setting in responses
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "activities" exist:
| activity | name | description | course | idnumber |
| questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 |
And "Test questionnaire" has questions and responses
And I am on the "Course 1" "Course" page logged in as "admin"
And I follow "Test questionnaire"
When I navigate to "View all responses" in current page administration
Then ".qn-number" "css_element" should exist
Given I follow "List of responses"
When I follow "Admin User"
Then ".qn-number" "css_element" should exist
# Check auto numbering not show in response when turned off.
Given I navigate to "Settings" in current page administration
And I set the field "Auto numbering" to "Do not number questions or pages"
And I press "Save and display"
When I navigate to "View all responses" in current page administration
Then ".qn-number" "css_element" should not exist
Given I follow "List of responses"
When I follow "Admin User"
Then ".qn-number" "css_element" should not exist

0 comments on commit 5c5491e

Please sign in to comment.