diff --git a/ajax.php b/ajax.php index a66a04f..6e923c4 100755 --- a/ajax.php +++ b/ajax.php @@ -367,7 +367,7 @@ function get_results(jazzquiz_session $session): array { $session->load_attempts(); $slot = count($session->questions); $qtype = $session->get_question_type_by_slot($slot); - $results = $session->get_question_results_list($slot); + $results = $session->get_question_results_list($slot, true); list($results['responses'], $mergecount) = $session->get_merged_responses($slot, $results['responses']); // Check if this has been voted on before. diff --git a/classes/exporter.php b/classes/exporter.php index 2aa47a7..cb65ca4 100755 --- a/classes/exporter.php +++ b/classes/exporter.php @@ -129,7 +129,7 @@ public function export_session_question(jazzquiz_session $session, jazzquiz_atte $qattempt = $attempt->quba->get_question_attempt($slot); $question = $qattempt->get_question(); $session->load_attempts(); - $responses = $session->get_question_results_list($slot); + $responses = $session->get_question_results_list($slot, false); $responses = $responses['responses']; $name = 'session_ ' . $session->data->id . '_' . $session->data->name . '_' . $question->name; return [$name, $question->questiontext, $responses]; diff --git a/classes/jazzquiz_session.php b/classes/jazzquiz_session.php index 4e69472..33e5229 100755 --- a/classes/jazzquiz_session.php +++ b/classes/jazzquiz_session.php @@ -470,7 +470,7 @@ public function get_question_right_response(): string { * @param int $slot * @return array */ - public function get_question_results_list(int $slot): array { + public function get_question_results_list(int $slot, bool $sanitized): array { $responses = []; $responded = 0; foreach ($this->attempts as $attempt) { @@ -478,6 +478,9 @@ public function get_question_results_list(int $slot): array { continue; } $attemptresponses = $attempt->get_response_data($slot); + if ($sanitized) { + $attemptresponses = array_map(fn($attemptresponse) => s($attemptresponse), $attemptresponses); + } $responses = array_merge($responses, $attemptresponses); $responded++; } diff --git a/classes/output/renderer.php b/classes/output/renderer.php index 8e339a5..7184e3a 100755 --- a/classes/output/renderer.php +++ b/classes/output/renderer.php @@ -290,7 +290,7 @@ public function view_session_report(jazzquiz_session $session, moodle_url $url): foreach ($attempt->quba->get_slots() as $qubaslot) { $qattempt = $attempt->quba->get_question_attempt($qubaslot); $question = $qattempt->get_question(); - $results = $session->get_question_results_list($qubaslot); + $results = $session->get_question_results_list($qubaslot, true); list($results['responses'], $mergecount) = $session->get_merged_responses($qubaslot, $results['responses']); $slots[] = [ 'num' => $qubaslot, diff --git a/version.php b/version.php index 37a9ea4..d3051a9 100755 --- a/version.php +++ b/version.php @@ -27,9 +27,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024032201; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2024032202; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2023100900; // Moodle 4.3 (or above). $plugin->cron = 0; // Period in seconds for cron to run. $plugin->component = 'mod_jazzquiz'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = '1.3.1 (Build: 2024032201)'; +$plugin->release = '1.3.2 (Build: 2024032202)';