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

Tidy up related issues with question variables which do not have a key.

parent 2e29b17e
Branches
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ How to report bugs and make suggestions is described on the [community](../About ...@@ -11,6 +11,7 @@ How to report bugs and make suggestions is described on the [community](../About
* Change in the behaviour of the CASEqual answer test. Now we always assume `simp:false`. * Change in the behaviour of the CASEqual answer test. Now we always assume `simp:false`.
* Add support for more AMS mathematics environments, including `\begin{align}...\end{align}`, `\begin{align*}...\end{align*}` etc. * Add support for more AMS mathematics environments, including `\begin{align}...\end{align}`, `\begin{align*}...\end{align*}` etc.
* STACK tried to automatically write an optimised image for linux. This should help installs where unix access is difficult.
## STACK custom reports ## STACK custom reports
......
...@@ -214,6 +214,7 @@ $string['questionvaluepostive'] = 'Question value must be positive'; ...@@ -214,6 +214,7 @@ $string['questionvaluepostive'] = 'Question value must be positive';
$string['questionvariables'] = 'Question variables'; $string['questionvariables'] = 'Question variables';
$string['questionvariables_help'] = 'This field allows you to define and manipulate CAS variables, e.g. to create random versions. These are available to all other parts of the question.'; $string['questionvariables_help'] = 'This field allows you to define and manipulate CAS variables, e.g. to create random versions. These are available to all other parts of the question.';
$string['questionvariables_link'] = '%%WWWROOT%%/question/type/stack/doc/doc.php/Authoring/KeyVals.md'; $string['questionvariables_link'] = '%%WWWROOT%%/question/type/stack/doc/doc.php/Authoring/KeyVals.md';
$string['questionvariablevalues'] = 'Question variable values';
$string['quiet'] = 'Quiet'; $string['quiet'] = 'Quiet';
$string['quiet_help'] = 'When set to yes any feedback automatically generated by the answer tests is suppressed, and not displayed to the student. The feedback fields in the branches are unaffected by this option.'; $string['quiet_help'] = 'When set to yes any feedback automatically generated by the answer tests is suppressed, and not displayed to the student. The feedback fields in the branches are unaffected by this option.';
$string['renamequestionparts'] = 'Rename parts of the question'; $string['renamequestionparts'] = 'Rename parts of the question';
......
...@@ -143,7 +143,7 @@ echo $OUTPUT->heading($title); ...@@ -143,7 +143,7 @@ echo $OUTPUT->heading($title);
echo $quba->render_question($slot, $options); echo $quba->render_question($slot, $options);
// Display the question variables. // Display the question variables.
echo $OUTPUT->heading(stack_string('questionvariables'), 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'));
foreach ($question->get_all_question_vars() as $key => $value) { foreach ($question->get_all_question_vars() as $key => $value) {
echo html_writer::tag('p', s($key) . ' = ' . s($value)); echo html_writer::tag('p', s($key) . ' = ' . s($value));
......
...@@ -230,7 +230,7 @@ echo html_writer::tag('p', stack_ouput_castext($question->get_question_summary() ...@@ -230,7 +230,7 @@ echo html_writer::tag('p', stack_ouput_castext($question->get_question_summary()
array('class' => 'questionnote')); array('class' => 'questionnote'));
// Display the question variables. // Display the question variables.
echo $OUTPUT->heading(stack_string('questionvariables'), 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'));
$displayqvs = ''; $displayqvs = '';
foreach ($question->get_all_question_vars() as $key => $value) { foreach ($question->get_all_question_vars() as $key => $value) {
...@@ -251,10 +251,19 @@ if ($question->options->get_option('simplify')) { ...@@ -251,10 +251,19 @@ if ($question->options->get_option('simplify')) {
} else { } else {
$simp = ''; $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 = $urlparams;
$chatparams['vars'] = $displayqvs; $chatparams['vars'] = $questionvarsinputs;
$chatparams['simp'] = $simp; $chatparams['simp'] = $simp;
$chatparams['cas'] = $question->generalfeedback; $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/caschat.php', $chatparams), stack_string('chat')); echo $OUTPUT->single_button(new moodle_url('/question/type/stack/caschat.php', $chatparams), stack_string('chat'));
// Display the controls to add another question test. // Display the controls to add another question test.
......
...@@ -401,8 +401,10 @@ class stack_cas_session { ...@@ -401,8 +401,10 @@ class stack_cas_session {
return array(); return array();
} }
foreach ($this->session as $cs) { foreach ($this->session as $cs) {
if ('' != $cs->get_key()) {
$keys[$cs->get_key()] = true; $keys[$cs->get_key()] = true;
} }
}
$keys = array_keys($keys); $keys = array_keys($keys);
return $keys; return $keys;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment