Merge pull request #3171 from dpalou/MOBILE-4001

MOBILE-4001 quiz: Display decimals in quiz review percentage
main
Pau Ferrer Ocaña 2022-03-14 11:22:36 +01:00 committed by GitHub
commit 3436f0bcad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -19,7 +19,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';
@ -311,9 +310,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 {