Skip to main content
Sign in
Snippets Groups Projects
Commit 1d70ca80 authored by Tim Hunt's avatar Tim Hunt
Browse files

Prevent blank penalties being changed to 0.

parent b4ab1d5c
No related branches found
No related tags found
No related merge requests found
......@@ -59,7 +59,7 @@ At this point STACK will be "ready" for use with students, although not all feat
1. **DONE** Only deploy new versions.
5. Editing form
1. Button to remove a node from a PRT.
6. Fix bug: penalties and other fields being changed from NULL to 0 when being stored in the database.
6. **DONE** Fix bug: penalties and other fields being changed from NULL to 0 when being stored in the database.
7. Add back Matrix input type. (currently only need to deal with naming of fields, and add tests)
8. Finish off the system for running Maxima on another server (https://github.com/maths/moodle-qtype_stack/pull/8)
......
......
......@@ -223,6 +223,7 @@ class qtype_stack_edit_form extends question_edit_form {
$mform->insertElementBefore($pen, 'generalfeedback');
$mform->addHelpButton('penalty', 'penalty', 'qtype_stack');
$mform->setDefault('penalty', 0.1000000);
$mform->addRule('penalty', null, 'required', null, 'client');
$sf = $mform->createElement('editor', 'specificfeedback',
get_string('specificfeedback', 'question'), array('rows' => 10), $this->editoroptions);
......
......
......@@ -178,6 +178,13 @@ class qtype_stack extends question_type {
$context, 'qtype_stack', 'prtnodefalsefeedback', $node->id);
$node->falsefeedbackformat = $fromform->{$prtname . 'falsefeedback'}[$nodename]['format'];
if ('' === $node->truepenalty) {
$node->truepenalty = null;
}
if ('' === $node->falsepenalty) {
$node->falsepenalty = null;
}
$DB->update_record('qtype_stack_prt_nodes', $node);
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment