From 93c80e1c0eca2a52731958141ca59628c2b6ef64 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 20 Mar 2007 22:23:56 +0000 Subject: [PATCH] MDL-8140 Other units disappear from the editing form when there is no unit with multiplier 1. Merged from MOODLE_18_STABLE. --- question/type/numerical/edit_numerical_form.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/question/type/numerical/edit_numerical_form.php b/question/type/numerical/edit_numerical_form.php index 4988b52208..0c8bd8f40e 100644 --- a/question/type/numerical/edit_numerical_form.php +++ b/question/type/numerical/edit_numerical_form.php @@ -92,6 +92,13 @@ class question_edit_numerical_form extends question_edit_form { 'if (1.0 === (float)$a->multiplier) { return -1; } else '. 'if (1.0 === (float)$b->multiplier) { return 1; } else { return 0; }')); if (count($units)) { + if (abs($units[0]->multiplier - 1.0) > 0.000001) { + echo "

Frog: ''.

"; // DONOTCOMMIT + $newunit = new stdClass; + $newunit->unit = ''; + $newunit->multiplier = 1.0; + $units = array_merge(array(0 => $newunit), $units); + } $key = 0; foreach ($units as $unit){ $default_values['unit['.$key.']'] = $unit->unit; -- 2.39.5