MOBILE-4001 quiz: Display decimals in quiz review percentage

main
Dani Palou 2022-03-11 15:10:37 +01:00
parent 0616f79df9
commit 1ac9d8dd9f
1 changed files with 3 additions and 4 deletions

View File

@ -18,7 +18,6 @@ import { CoreQuestionHelper } from '@features/question/services/question-helper'
import { IonContent, IonRefresher } from '@ionic/angular'; import { IonContent, IonRefresher } from '@ionic/angular';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom'; import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreTimeUtils } from '@services/utils/time'; import { CoreTimeUtils } from '@services/utils/time';
import { CoreUtils } from '@services/utils/utils'; import { CoreUtils } from '@services/utils/utils';
import { Translate } from '@singletons'; import { Translate } from '@singletons';
@ -303,9 +302,9 @@ export class AddonModQuizReviewPage implements OnInit {
}; };
if (this.quiz.grade != 100) { if (this.quiz.grade != 100) {
gradeObject.percent = CoreTextUtils.roundToDecimals( gradeObject.percent = AddonModQuiz.formatGrade(
this.attempt.sumgrades! * 100 / this.quiz.sumgrades!, (this.attempt.sumgrades ?? 0) * 100 / (this.quiz.sumgrades ?? 1),
0, this.quiz.decimalpoints,
); );
this.readableGrade = Translate.instant('addon.mod_quiz.outofpercent', { $a: gradeObject }); this.readableGrade = Translate.instant('addon.mod_quiz.outofpercent', { $a: gradeObject });
} else { } else {