From 0a5aa9c610b84b5917f05a710c5b5bac0061ce07 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Sun, 19 May 2013 23:39:23 +0100 Subject: [PATCH] MDL-27748 question: grade options should be localised. question_bank::fraction_options should use format_float to display decimal pionts correctly. --- question/engine/bank.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/question/engine/bank.php b/question/engine/bank.php index d885531855fbc..b329b31409abc 100644 --- a/question/engine/bank.php +++ b/question/engine/bank.php @@ -380,14 +380,15 @@ protected static function ensure_fraction_options_initialised() { // The the positive grades in descending order. foreach ($rawfractions as $fraction) { - $percentage = (100 * $fraction) . '%'; + $percentage = format_float(100 * $fraction, 5, true, true) . '%'; self::$fractionoptions["$fraction"] = $percentage; self::$fractionoptionsfull["$fraction"] = $percentage; } // The the negative grades in descending order. foreach (array_reverse($rawfractions) as $fraction) { - self::$fractionoptionsfull['' . (-$fraction)] = (-100 * $fraction) . '%'; + self::$fractionoptionsfull['' . (-$fraction)] = + format_float(-100 * $fraction, 5, true, true) . '%'; } self::$fractionoptionsfull['-1.0'] = '-100%';