Skip to content

Commit e69bd4c

Browse files
AnupamaSarjoshitrampgeek
authored andcommitted
Adding category and course shortname to bulk test report (#212)
1 parent 403be9f commit e69bd4c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

classes/bulk_tester.php

+12-5
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,17 @@ public function run_all_tests_for_context(context $context, $categoryid = null)
187187
global $OUTPUT;
188188

189189
// Load the necessary data.
190+
$coursename = $context->get_context_name(true, true);
190191
$categories = $this->get_categories_for_context($context->id);
191192
$questiontestsurl = new moodle_url('/question/type/coderunner/questiontestrun.php');
192193
if ($context->contextlevel == CONTEXT_COURSE) {
193-
$questiontestsurl->param('courseid', $context->instanceid);
194+
$qparams['courseid'] = $context->instanceid;
194195
} else if ($context->contextlevel == CONTEXT_MODULE) {
195-
$questiontestsurl->param('cmid', $context->instanceid);
196+
$qparams['cmid'] = $context->instanceid;
196197
} else {
197-
$questiontestsurl->param('courseid', SITEID);
198+
$qparams['courseid'] = SITEID;
198199
}
200+
$questiontestsurl->params($qparams);
199201
$numpasses = 0;
200202
$failingtests = [];
201203
$missinganswers = [];
@@ -233,12 +235,17 @@ public function run_all_tests_for_context(context $context, $categoryid = null)
233235
// Report the result, and record failures for the summary.
234236
echo " $message</li>";
235237
flush(); // Force output to prevent timeouts and show progress.
238+
$qparams['category'] = $currentcategoryid . ',' . $context->id;
239+
$qparams['lastchanged'] = $question->id;
240+
$qparams['qperpage'] = 1000;
241+
$questionbankurl = new moodle_url('/question/edit.php', $qparams);
242+
$questionbanklink = html_writer::link($questionbankurl, $nameandcount->name, ['target' => '_blank']);
236243
if ($outcome === self::PASS) {
237244
$numpasses += 1;
238245
} else if ($outcome === self::MISSINGANSWER) {
239-
$missinganswers[] = $questionnamelink;
246+
$missinganswers[] = "$coursename / $questionbanklink / $questionnamelink";
240247
} else {
241-
$failingtests[] = "$questionnamelink: $message";
248+
$failingtests[] = "$coursename / $questionbanklink / $questionnamelink: $message";
242249
}
243250
}
244251
echo "</ul>\n";

0 commit comments

Comments
 (0)