Skip to content
Snippets Groups Projects
Commit 803166a4 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Consolidate links at the top of the question test run page.

parent 94b22056
No related branches found
No related tags found
No related merge requests found
...@@ -539,6 +539,7 @@ $string['runquestiontests_help'] = 'The question tests unit-test the questions t ...@@ -539,6 +539,7 @@ $string['runquestiontests_help'] = 'The question tests unit-test the questions t
$string['runquestiontests_alert'] = 'Question is missing tests or variants.'; $string['runquestiontests_alert'] = 'Question is missing tests or variants.';
$string['seethisquestioninthequestionbank'] = 'See this question in the question bank'; $string['seethisquestioninthequestionbank'] = 'See this question in the question bank';
$string['editquestioninthequestionbank'] = 'Edit this question'; $string['editquestioninthequestionbank'] = 'Edit this question';
$string['sendgeneralfeedback'] = 'Send general feedback to the CAS';
$string['showingundeployedvariant'] = 'Showing undeployed variant: {$a}'; $string['showingundeployedvariant'] = 'Showing undeployed variant: {$a}';
$string['switchtovariant'] = 'Switch to variant: '; $string['switchtovariant'] = 'Switch to variant: ';
$string['testcasexresult'] = 'Test case {$a->no} {$a->result}'; $string['testcasexresult'] = 'Test case {$a->no} {$a->result}';
......
...@@ -134,6 +134,39 @@ if ($qversion !== null) { ...@@ -134,6 +134,39 @@ if ($qversion !== null) {
echo html_writer::tag('p', stack_string('version') . ' ' . $qversion); echo html_writer::tag('p', stack_string('version') . ' ' . $qversion);
} }
// Add a link to the cas chat to facilitate editing the general feedback.
if ($question->options->get_option('simplify')) {
$simp = 'on';
} else {
$simp = '';
}
$questionvarsinputs = $question->questionvariables;
foreach ($question->get_correct_response() as $key => $val) {
if (substr($key, -4, 4) !== '_val') {
$questionvarsinputs .= "\n{$key}:{$val};";
}
}
// We've chosen not to send a specific seed since it is helpful to test the general feedback in a random context.
$chatparams = $urlparams;
$chatparams['vars'] = $questionvarsinputs;
$chatparams['simp'] = $simp;
$chatparams['cas'] = $question->generalfeedback;
$chatlink = new moodle_url('/question/type/stack/adminui/caschat.php', $chatparams);
$links = array();
$links[] = html_writer::link($questionbanklink, stack_string('seethisquestioninthequestionbank'));
if ($canedit) {
$links[] = html_writer::link($questionbanklinkedit, stack_string('editquestioninthequestionbank'));
$links[] = html_writer::link($chatlink, stack_string('sendgeneralfeedback'));
$links[] = html_writer::link($exportquestionlink, stack_string('exportthisquestion')) .
$OUTPUT->help_icon('exportthisquestion', 'qtype_stack');
}
$links[] = html_writer::link(new moodle_url('/question/type/stack/questiontestreport.php', $urlparams),
stack_string('basicquestionreport')) . $OUTPUT->help_icon('basicquestionreport', 'qtype_stack');
echo html_writer::tag('p', implode(' | ', $links));
flush(); flush();
$question->castextprocessor = new castext2_qa_processor($quba->get_question_attempt($slot)); $question->castextprocessor = new castext2_qa_processor($quba->get_question_attempt($slot));
...@@ -406,13 +439,19 @@ if ($question->runtimeerrors || $generalfeedbackerr) { ...@@ -406,13 +439,19 @@ if ($question->runtimeerrors || $generalfeedbackerr) {
// Display the test results. // Display the test results.
$addlabel = stack_string('addanothertestcase', 'qtype_stack'); $addlabel = stack_string('addanothertestcase', 'qtype_stack');
$basemsg = '';
if ($question->has_random_variants()) {
$basemsg = stack_string('questiontestsfor', $seed) . ': ';
}
if (empty($testresults)) { if (empty($testresults)) {
echo html_writer::tag('p', stack_string_error('runquestiontests_alert') . ' ' . stack_string('notestcasesyet')); echo html_writer::tag('p', stack_string_error('runquestiontests_alert') . ' ' . stack_string('notestcasesyet'));
$addlabel = stack_string('addatestcase', 'qtype_stack'); $addlabel = stack_string('addatestcase', 'qtype_stack');
} else if ($allpassed) { } else if ($allpassed) {
echo html_writer::tag('p', stack_string('stackInstall_testsuite_pass'), array('class' => 'overallresult pass')); echo html_writer::tag('p', $basemsg .
stack_string('stackInstall_testsuite_pass'), array('class' => 'overallresult pass'));
} else { } else {
echo html_writer::tag('p', stack_string_error('stackInstall_testsuite_fail'), array('class' => 'overallresult fail')); echo html_writer::tag('p', $basemsg .
stack_string_error('stackInstall_testsuite_fail'), array('class' => 'overallresult fail'));
} }
if ($canedit) { if ($canedit) {
...@@ -556,19 +595,6 @@ foreach ($testresults as $key => $result) { ...@@ -556,19 +595,6 @@ foreach ($testresults as $key => $result) {
} }
} }
$links = array();
$links[] = html_writer::link($questionbanklink, stack_string('seethisquestioninthequestionbank'));
if ($canedit) {
$links[] = html_writer::link($questionbanklinkedit, stack_string('editquestioninthequestionbank'));
$links[] = html_writer::link($exportquestionlink, stack_string('exportthisquestion')) .
$OUTPUT->help_icon('exportthisquestion', 'qtype_stack');
}
echo html_writer::tag('p', implode(' | ', $links));
echo html_writer::tag('p',
html_writer::link(new moodle_url('/question/type/stack/questiontestreport.php', $urlparams),
stack_string('basicquestionreport')) . $OUTPUT->help_icon('basicquestionreport', 'qtype_stack'));
// Display the question variables. // Display the question variables.
echo $OUTPUT->heading(stack_string('questionvariablevalues'), 3); echo $OUTPUT->heading(stack_string('questionvariablevalues'), 3);
echo html_writer::start_tag('div', array('class' => 'questionvariables')); echo html_writer::start_tag('div', array('class' => 'questionvariables'));
...@@ -604,27 +630,6 @@ echo $OUTPUT->heading(stack_string('generalfeedback'), 3); ...@@ -604,27 +630,6 @@ echo $OUTPUT->heading(stack_string('generalfeedback'), 3);
echo html_writer::tag('div', html_writer::tag('div', $rendergeneralfeedback, echo html_writer::tag('div', html_writer::tag('div', $rendergeneralfeedback,
array('class' => 'outcome generalfeedback')), array('class' => 'que')); array('class' => 'outcome generalfeedback')), array('class' => 'que'));
// Add a link to the cas chat to facilitate editing the general feedback.
if ($question->options->get_option('simplify')) {
$simp = 'on';
} else {
$simp = '';
}
$questionvarsinputs = $question->questionvariables;
foreach ($question->get_correct_response() as $key => $val) {
if (substr($key, -4, 4) !== '_val') {
$questionvarsinputs .= "\n{$key}:{$val};";
}
}
$chatparams = $urlparams;
$chatparams['vars'] = $questionvarsinputs;
$chatparams['simp'] = $simp;
$chatparams['cas'] = $question->generalfeedback;
// We've chosen not to send a specific seed since it is helpful
// to test the general feedback in a random context.
echo $OUTPUT->single_button(new moodle_url('/question/type/stack/adminui/caschat.php', $chatparams), stack_string('chat'));
if ($question->stackversion == null) { if ($question->stackversion == null) {
echo html_writer::tag('p', stack_string('stackversionnone')); echo html_writer::tag('p', stack_string('stackversionnone'));
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment