Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-27748 question: grade options should be localised.

question_bank::fraction_options should use format_float to display
decimal pionts correctly.
  • Loading branch information...
commit 0377e4fbc9ce04550d862d844e1871150cfbb1d8 1 parent e038687
Tim Hunt timhunt authored

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. +3 2 question/engine/bank.php
5 question/engine/bank.php
@@ -380,14 +380,15 @@ protected static function ensure_fraction_options_initialised() {
380 380
381 381 // The the positive grades in descending order.
382 382 foreach ($rawfractions as $fraction) {
383   - $percentage = (100 * $fraction) . '%';
  383 + $percentage = format_float(100 * $fraction, 5, true, true) . '%';
384 384 self::$fractionoptions["$fraction"] = $percentage;
385 385 self::$fractionoptionsfull["$fraction"] = $percentage;
386 386 }
387 387
388 388 // The the negative grades in descending order.
389 389 foreach (array_reverse($rawfractions) as $fraction) {
390   - self::$fractionoptionsfull['' . (-$fraction)] = (-100 * $fraction) . '%';
  390 + self::$fractionoptionsfull['' . (-$fraction)] =
  391 + format_float(-100 * $fraction, 5, true, true) . '%';
391 392 }
392 393
393 394 self::$fractionoptionsfull['-1.0'] = '-100%';

0 comments on commit 0377e4f

Please sign in to comment.
Something went wrong with that request. Please try again.