From f9cecaf2f152c66e7af2bd174d75d816fa1f240c Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 20 Mar 2007 22:23:50 +0000 Subject: [PATCH] MDL-8140 Other units disappear from the editing form when there is no unit with multiplier 1. Effectively the same fix as just applied to MOODLE_1.7_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 4988b522089..0c8bd8f40ee 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;