Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto numbers always on view all responses #605 #606

Open
wants to merge 1 commit into
base: MOODLE_404_STABLE
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
25 changes: 25 additions & 0 deletions tests/behat/check_responses.feature
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,28 @@ 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