From f3301e1766b3cf9ec97f8e18ac25af85fd76f6da Mon Sep 17 00:00:00 2001 From: Zef Oudendorp Date: Wed, 1 Feb 2023 14:42:23 +0100 Subject: [PATCH 1/2] Update #86778u02jfix number of respondents for singe questiontype --- classes/responsetype/single.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/classes/responsetype/single.php b/classes/responsetype/single.php index d8dc2f7c..d4fffa6a 100644 --- a/classes/responsetype/single.php +++ b/classes/responsetype/single.php @@ -227,7 +227,6 @@ public function results_template($pdf = false) { * @return string */ public function display_results($rids=false, $sort='', $anonymous=false) { - global $DB; $rows = $this->get_results($rids, $anonymous); if (is_array($rids)) { @@ -237,11 +236,7 @@ public function display_results($rids=false, $sort='', $anonymous=false) { } $numresps = count($rids); - $responsecountsql = 'SELECT COUNT(DISTINCT r.response_id) ' . - 'FROM {' . $this->response_table() . '} r ' . - 'WHERE r.question_id = ? '; - $numrespondents = $DB->count_records_sql($responsecountsql, [$this->question->id]); - + $numrespondents = 0; if ($rows) { $counts = []; foreach ($rows as $idx => $row) { @@ -257,6 +252,7 @@ public function display_results($rids=false, $sort='', $anonymous=false) { $textidx = $contents->text.$contents->image; $counts[$textidx] = !empty($counts[$textidx]) ? ($counts[$textidx] + 1) : 1; } + $numrespondents++; } $pagetags = $this->get_results_tags($counts, $numresps, $numrespondents, $prtotal, $sort); } else { From b19ffa48380434f47ef5215dccd8ebcb1089880d Mon Sep 17 00:00:00 2001 From: Zef Oudendorp Date: Wed, 1 Feb 2023 15:25:46 +0100 Subject: [PATCH 2/2] Update #86778u02j version --- version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.php b/version.php index 2240b82a..a4f12a1a 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2022092200; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2023020100; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2022030300; // Moodle version (4.0). $plugin->component = 'mod_questionnaire';