MDL-63390 Quiz: Use lang rules to format quiz summark as a percentage

Part of MDL-62610
This commit is contained in:
Shamim Rezaie 2018-09-28 16:29:28 +10:00 committed by Simey Lameze
parent bef224c6e4
commit 24c28f3c9b
2 changed files with 4 additions and 3 deletions

View File

@ -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);
}
/**

View File

@ -66,9 +66,9 @@ class mod_quiz_reportlib_testcase extends advanced_testcase {
$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));