Skip to content

Commit

Permalink
MDL-27748 question: grade options should be localised.
Browse files Browse the repository at this point in the history
question_bank::fraction_options should use format_float to display
decimal pionts correctly.
  • Loading branch information
timhunt committed May 19, 2013
1 parent f0d8c53 commit 7f94308
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions question/engine/bank.php
Expand Up @@ -368,14 +368,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%';
Expand Down

0 comments on commit 7f94308

Please sign in to comment.