Skip to content

Commit ebdf66d

Browse files
authored
Merge branch 'PoetOS:MOODLE_401_STABLE' into wip253248
2 parents a2c6142 + 6253d1a commit ebdf66d

File tree

6 files changed

+32
-21
lines changed

6 files changed

+32
-21
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: [push, pull_request]
33

44
jobs:
55
test:
6-
runs-on: 'ubuntu-latest'
6+
runs-on: ubuntu-22.04
77

88
services:
99
postgres:
@@ -14,14 +14,14 @@ jobs:
1414
ports:
1515
- 5432:5432
1616
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
17+
1718
mariadb:
18-
image: mariadb:10.6
19+
image: mariadb:10
1920
env:
2021
MYSQL_USER: 'root'
2122
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
2223
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
2324
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
24-
2525
ports:
2626
- 3306:3306
2727
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
@@ -45,7 +45,7 @@ jobs:
4545

4646
steps:
4747
- name: Checkout
48-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
4949
with:
5050
path: plugin
5151

@@ -60,12 +60,12 @@ jobs:
6060

6161
- name: Deploy moodle-plugin-ci
6262
run: |
63-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
64-
# Add dirs to $PATH
63+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
6564
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
6665
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
67-
# PHPUnit depends on en_AU.UTF-8 locale
6866
sudo locale-gen en_AU.UTF-8
67+
# Install nvm.
68+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
6969
7070
- name: Install Moodle
7171
# Need explicit IP to stop mysql client fail on attempt to use unix socket.

classes/question/numerical.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function question_survey_display($response, $descendantsdata, $blankqu
8383
// Numeric.
8484
$questiontags = new \stdClass();
8585
$precision = $this->precise;
86-
$a = new \StdClass();
86+
$a = new \stdClass();
8787
if (isset($response->answers[$this->id][0])) {
8888
$mynumber = $response->answers[$this->id][0]->value;
8989
if ($mynumber != '') {

lang/en/questionnaire.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@
151151
$string['download'] = 'Download';
152152
$string['downloadpdf'] = 'Download PDF';
153153
$string['downloadtextformat'] = 'Download';
154-
$string['downloadtextformat_help'] = 'This feature enables you to save all the responses of a questionnaire to a selectable, supported file format.
155-
You can choose to include extra data items in the export, as well as choose to automatically send the file to selected users.';
154+
$string['downloadtextformat_help'] = 'This feature enables you to download questionnaire responses in a file format of your choice.
155+
The file can then be opened in a spreadsheet program (e.g. MS Excel or Open Office Calc) or a statistical package for further processing.';
156156
$string['downloadtextformat_link'] = 'mod/questionnaire/report#Download_in_text_format';
157157
$string['downloadtypes'] = 'Report type';
158158
$string['dropdown'] = 'Dropdown Box';

locallib.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@
6868

6969
global $questionnaireresponseviewers;
7070
$questionnaireresponseviewers = array (
71+
QUESTIONNAIRE_STUDENTVIEWRESPONSES_NEVER => get_string('responseviewstudentsnever', 'questionnaire'),
7172
QUESTIONNAIRE_STUDENTVIEWRESPONSES_WHENANSWERED => get_string('responseviewstudentswhenanswered', 'questionnaire'),
7273
QUESTIONNAIRE_STUDENTVIEWRESPONSES_WHENCLOSED => get_string('responseviewstudentswhenclosed', 'questionnaire'),
73-
QUESTIONNAIRE_STUDENTVIEWRESPONSES_ALWAYS => get_string('responseviewstudentsalways', 'questionnaire'),
74-
QUESTIONNAIRE_STUDENTVIEWRESPONSES_NEVER => get_string('responseviewstudentsnever', 'questionnaire'));
74+
QUESTIONNAIRE_STUDENTVIEWRESPONSES_ALWAYS => get_string('responseviewstudentsalways', 'questionnaire'));
7575

7676
global $autonumbering;
7777
$autonumbering = array (0 => get_string('autonumberno', 'questionnaire'),

questionnaire.class.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -851,9 +851,10 @@ public function count_submissions($userid=false, $groupid=0) {
851851
*
852852
* @param int|bool $userid
853853
* @param int $groupid
854+
* @param int|bool $includeincomplete
854855
* @return array
855856
*/
856-
public function get_responses($userid=false, $groupid=0) {
857+
public function get_responses($userid=false, $groupid=0, $includeincomplete=false) {
857858
global $DB;
858859

859860
$params = [];
@@ -865,6 +866,12 @@ public function get_responses($userid=false, $groupid=0) {
865866
$params['groupid'] = $groupid;
866867
}
867868

869+
$statuscnd = '';
870+
if (!$includeincomplete) {
871+
$statuscnd = ' AND r.complete = :status ';
872+
$params['status'] = 'y';
873+
}
874+
868875
// Since submission can be across questionnaires in the case of public questionnaires, need to check the realm.
869876
// Public questionnaires can have responses to multiple questionnaire instances.
870877
if ($this->survey_is_public_master()) {
@@ -873,16 +880,14 @@ public function get_responses($userid=false, $groupid=0) {
873880
'INNER JOIN {questionnaire} q ON r.questionnaireid = q.id ' .
874881
'INNER JOIN {questionnaire_survey} s ON q.sid = s.id ' .
875882
$groupsql .
876-
'WHERE s.id = :surveyid AND r.complete = :status' . $groupcnd;
883+
'WHERE s.id = :surveyid' . $statuscnd . $groupcnd;
877884
$params['surveyid'] = $this->sid;
878-
$params['status'] = 'y';
879885
} else {
880886
$sql = 'SELECT r.* ' .
881887
'FROM {questionnaire_response} r ' .
882888
$groupsql .
883-
'WHERE r.questionnaireid = :questionnaireid AND r.complete = :status' . $groupcnd;
889+
'WHERE r.questionnaireid = :questionnaireid' . $statuscnd . $groupcnd;
884890
$params['questionnaireid'] = $this->id;
885-
$params['status'] = 'y';
886891
}
887892
if ($userid) {
888893
$sql .= ' AND r.userid = :userid';

report.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@
267267
case 'delallresp': // Delete all responses? Ask for confirmation.
268268
require_capability('mod/questionnaire:deleteresponses', $context);
269269

270+
// Get all responses including incompletes.
271+
$respsallparticipants = $questionnaire->get_responses(false, 0, true);
272+
270273
if (!empty($respsallparticipants)) {
271274

272275
// Print the page header.
@@ -357,6 +360,9 @@
357360
throw new \moodle_exception('surveyowner', 'mod_questionnaire');
358361
}
359362

363+
// Get all responses including incompletes.
364+
$respsallparticipants = $questionnaire->get_responses(false, 0, true);
365+
360366
// Available group modes (0 = no groups; 1 = separate groups; 2 = visible groups).
361367
if ($groupmode > 0) {
362368
switch ($currentgroupid) {
@@ -449,10 +455,10 @@
449455
}
450456
$output = '';
451457
$output .= "<br /><br />\n";
452-
$output .= $questionnaire->renderer->help_icon('downloadtextformat', 'questionnaire');
453-
$output .= '&nbsp;' . (get_string('downloadtextformat', 'questionnaire')) . ':&nbsp;' .
454-
get_string('responses', 'questionnaire').'&nbsp;'.$groupname;
455-
$output .= $questionnaire->renderer->heading(get_string('textdownloadoptions', 'questionnaire'));
458+
$output .= html_writer::tag('h2', (get_string('downloadtextformat', 'questionnaire'))
459+
. ':&nbsp;' . get_string('responses', 'questionnaire') . '&nbsp;' .
460+
$groupname . $questionnaire->renderer->help_icon('downloadtextformat', 'questionnaire'));
461+
$output .= $questionnaire->renderer->heading(get_string('textdownloadoptions', 'questionnaire'), 3);
456462
$output .= $questionnaire->renderer->box_start();
457463
$downloadparams = [
458464
'instance' => $instance,

0 commit comments

Comments
 (0)