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

Revert the decision to run all tests on all variants automatically. This...

Revert the decision to run all tests on all variants automatically.  This proves to be too slow, so a button has been added.
parent eccec25f
Branches
No related tags found
No related merge requests found
......@@ -104,7 +104,7 @@ $string['feedbackvariables_link'] = '%%WWWROOT%%/question/type/stack/doc/doc.php
$string['fieldshouldnotcontainplaceholder'] = '{$a->field} should not contain any [[{$a->type}:...]] placeholders.';
$string['firstnodemusthavelowestnumber'] = 'The first node must have the lowest number.';
$string['fixdollars'] = 'Fix dollars';
$string['fixdollarslabel'] = 'Replace <code>$...$</code> with <code>\(...\)</code> and <code>$$...$$</code> with <code>\[...\]</code> on save.';
$string['fixdollarslabel'] = 'Replace <code>$...$</code> with <code>\(...\)</code>, <code>$$...$$</code> with <code>\[...\]</code> and <code>@...@</code> with <code>{@...@}</code> on save.';
$string['fixdollars_help'] = 'This option is useful if are copying and pasting (or typing) TeX with <code>$...$</code> and <code>$$...$$</code> delimiters. Those delimiters will be replaced by the recommended delimiters during the save process.';
$string['forbiddendoubledollars'] = 'Please use the delimiters <code>\(...\)</code> for inline maths and <code>\[...\]</code> for display maths. <code>$...$</code> and <code>$$...$$</code> are not permitted. There is an option at the end of the form to fix this automatically.';
$string['forbidfloat'] = 'Forbid float';
......@@ -418,6 +418,7 @@ $string['deploymanynonew'] = 'Too many repeated existing question notes were gen
$string['deploymanynotes'] = 'Note, STACK will give up if there are 10 failed attempts to generate a new question note, or when one question test fails.';
$string['deploymanysuccess'] = 'Number of new variants successfully created, tested and deployed: {$a->no}.';
$string['deployremoveall'] = 'Undeploy all variants: ';
$string['deploytestall'] = 'Run all tests on all deployed variants (slow): ';
$string['editingtestcase'] = 'Editing test case {$a->no} for question {$a->question}';
$string['editthistestcase'] = 'Edit this test case...';
$string['expectedanswernote'] = 'Expected answer note';
......
......@@ -38,7 +38,6 @@ require_once(__DIR__ . '/locallib.php');
require_once(__DIR__ . '/stack/questiontest.php');
require_once(__DIR__ . '/stack/bulktester.class.php');
// Get the parameters from the URL.
$questionid = required_param('questionid', PARAM_INT);
......@@ -168,11 +167,14 @@ if (!$question->has_random_variants()) {
new pix_icon('t/delete', stack_string('undeploy')));
}
// Bulk test all versions.
$bulktester = new stack_bulk_tester();
$qn = question_bank::load_question($questionid);
$bulktestresults = array(false, '');
if (optional_param('testall', null, PARAM_INT)) {
// Bulk test all versions.
$bulktester = new stack_bulk_tester();
$bulktestresults = $bulktester->qtype_stack_test_question($qn, $testscases, $deployedseed, true);
}
// Print out question notes of all deployed versions.
$qn->seed = (int) $deployedseed;
......@@ -197,6 +199,7 @@ if (!$question->has_random_variants()) {
$icon,
$bulktestresults[1]
);
flush();
}
echo html_writer::table($notestable);
......@@ -219,47 +222,48 @@ if (!$variantmatched) {
}
if ($question->has_random_variants()) {
echo html_writer::start_tag('p');
echo html_writer::start_tag('form', array('method' => 'get', 'class' => 'switchtovariant',
'action' => new moodle_url('/question/type/stack/questiontestrun.php')));
echo html_writer::start_tag('p');
echo html_writer::input_hidden_params($PAGE->url, array('seed'));
echo html_writer::tag('label', stack_string('switchtovariant'), array('for' => 'seedfield'));
echo stack_string('switchtovariant');
echo ' ' . html_writer::empty_tag('input', array('type' => 'text', 'size' => 7,
'id' => 'seedfield', 'name' => 'seed', 'value' => mt_rand()));
echo ' ' . html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
echo html_writer::end_tag('p');
echo html_writer::end_tag('form');
if ($canedit) {
// Run tests on all the variants.
echo html_writer::start_tag('form', array('method' => 'get', 'class' => 'deploymany',
'action' => new moodle_url('/question/type/stack/questiontestrun.php', $urlparams)));
echo stack_string('deploytestall');
echo html_writer::input_hidden_params(new moodle_url($PAGE->url, array('sesskey' => sesskey(),
'testall' => '1')));
echo ' ' . html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
echo html_writer::end_tag('form');
// Deploy many variants.
echo html_writer::start_tag('form', array('method' => 'get', 'class' => 'deploymany',
'action' => new moodle_url('/question/type/stack/deploy.php', $urlparams)));
echo html_writer::start_tag('p');
echo html_writer::input_hidden_params(new moodle_url($PAGE->url, array('sesskey' => sesskey())), array('seed'));
echo html_writer::tag('label', stack_string('deploymany'));
echo stack_string('deploymany');
echo ' ' . html_writer::empty_tag('input', array('type' => 'text', 'size' => 4,
'id' => 'deploymanyfield', 'name' => 'deploymany', 'value' => ''));
echo ' ' . html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
echo html_writer::tag('label', ' '.stack_string('deploymanynotes'));
echo html_writer::end_tag('p');
echo ' ' . stack_string('deploymanynotes');
echo html_writer::end_tag('form');
// Undeploy all the variants.
echo html_writer::start_tag('form', array('method' => 'get', 'class' => 'deploymany',
'action' => new moodle_url('/question/type/stack/deploy.php', $urlparams)));
echo html_writer::start_tag('p');
echo stack_string('deployremoveall');
echo html_writer::input_hidden_params(new moodle_url($PAGE->url, array('sesskey' => sesskey(),
'undeployall' => 'true')));
echo ' ' . html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
echo html_writer::end_tag('p');
echo html_writer::end_tag('form');
}
echo html_writer::end_tag('p');
}
// Display the controls to add another question test.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment