mirror of
https://github.com/moodle/moodle.git
synced 2025-03-13 20:26:32 +01:00
MDL-12282 - Numerical question type - the units are displayed on the editing form with a stupidly large number of decimal places. Merged from MOODLE_18_STABLE.
This commit is contained in:
parent
987c5893ac
commit
b4d7d27cea
@ -62,7 +62,7 @@ class question_edit_numerical_form extends question_edit_form {
|
||||
$mform->setType('unit', PARAM_NOTAGS);
|
||||
|
||||
$repeated[] =& $mform->createElement('text', 'multiplier', get_string('multiplier', 'quiz'));
|
||||
$mform->setType('multiplier', PARAM_NOTAGS);
|
||||
$mform->setType('multiplier', PARAM_NUMBER);
|
||||
|
||||
if (isset($this->question->options)){
|
||||
$countunits = count($this->question->options->units);
|
||||
|
@ -60,12 +60,16 @@ class question_numerical_qtype extends question_shortanswer_qtype {
|
||||
}
|
||||
|
||||
function get_numerical_units(&$question) {
|
||||
if ($question->options->units = get_records('question_numerical_units',
|
||||
if ($units = get_records('question_numerical_units',
|
||||
'question', $question->id, 'id ASC')) {
|
||||
$question->options->units = array_values($question->options->units);
|
||||
$units = array_values($question->options->units);
|
||||
} else {
|
||||
$question->options->units = array();
|
||||
$units = array();
|
||||
}
|
||||
foreach ($units as $key => $unit) {
|
||||
$units[$key]->multiplier = clean_param($unit->multiplier, PARAM_NUMBER);
|
||||
}
|
||||
$question->options->units = $units;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user