Skip to content

Commit

Permalink
MDL-63390 Quiz: Use lang rules to format quiz summark as a percentage
Browse files Browse the repository at this point in the history
Part of MDL-62610
  • Loading branch information
rezaies authored and lameze committed Sep 30, 2018
1 parent bef224c commit 24c28f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion mod/quiz/report/reportlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ function quiz_report_scale_summarks_as_percentage($rawmark, $quiz, $round = true
if ($round) {
$mark = quiz_format_grade($quiz, $mark);
}
return $mark . '%';

return get_string('percents', 'moodle', $mark);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions mod/quiz/tests/reportlib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public function test_quiz_report_scale_summarks_as_percentage() {
$quiz->sumgrades = 10;
$quiz->decimalpoints = 2;

$this->assertEquals('12.34567%',
$this->assertEquals('12.34567 %',
quiz_report_scale_summarks_as_percentage(1.234567, $quiz, false));
$this->assertEquals('12.35%',
$this->assertEquals('12.35 %',
quiz_report_scale_summarks_as_percentage(1.234567, $quiz, true));
$this->assertEquals('-',
quiz_report_scale_summarks_as_percentage('-', $quiz, true));
Expand Down

0 comments on commit 24c28f3

Please sign in to comment.