From f36b4dff0acc71b975393abaa136109fa446ce43 Mon Sep 17 00:00:00 2001 From: Anupama Sarjoshi <81178902+AnupamaSarjoshi@users.noreply.github.com> Date: Fri, 19 Apr 2024 01:07:35 +0100 Subject: [PATCH] Adding category and course shortname to bulk test report (#212) --- classes/bulk_tester.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/classes/bulk_tester.php b/classes/bulk_tester.php index 41e7e2ba7..fbad17031 100644 --- a/classes/bulk_tester.php +++ b/classes/bulk_tester.php @@ -187,15 +187,17 @@ public function run_all_tests_for_context(context $context, $categoryid = null) global $OUTPUT; // Load the necessary data. + $coursename = $context->get_context_name(true, true); $categories = $this->get_categories_for_context($context->id); $questiontestsurl = new moodle_url('/question/type/coderunner/questiontestrun.php'); if ($context->contextlevel == CONTEXT_COURSE) { - $questiontestsurl->param('courseid', $context->instanceid); + $qparams['courseid'] = $context->instanceid; } else if ($context->contextlevel == CONTEXT_MODULE) { - $questiontestsurl->param('cmid', $context->instanceid); + $qparams['cmid'] = $context->instanceid; } else { - $questiontestsurl->param('courseid', SITEID); + $qparams['courseid'] = SITEID; } + $questiontestsurl->params($qparams); $numpasses = 0; $failingtests = []; $missinganswers = []; @@ -233,12 +235,17 @@ public function run_all_tests_for_context(context $context, $categoryid = null) // Report the result, and record failures for the summary. echo " $message"; flush(); // Force output to prevent timeouts and show progress. + $qparams['category'] = $currentcategoryid . ',' . $context->id; + $qparams['lastchanged'] = $question->id; + $qparams['qperpage'] = 1000; + $questionbankurl = new moodle_url('/question/edit.php', $qparams); + $questionbanklink = html_writer::link($questionbankurl, $nameandcount->name, ['target' => '_blank']); if ($outcome === self::PASS) { $numpasses += 1; } else if ($outcome === self::MISSINGANSWER) { - $missinganswers[] = $questionnamelink; + $missinganswers[] = "$coursename / $questionbanklink / $questionnamelink"; } else { - $failingtests[] = "$questionnamelink: $message"; + $failingtests[] = "$coursename / $questionbanklink / $questionnamelink: $message"; } } echo "\n";