MOBILE-4550 quiz: Always display max number of decimals in grades

main
Dani Palou 2024-05-15 08:54:35 +02:00
parent 691ad40490
commit 00d02bc502
3 changed files with 5 additions and 6 deletions

View File

@ -30,7 +30,6 @@ import {
import { CoreQuestionDelegate } from '@features/question/services/question-delegate';
import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreTimeUtils } from '@services/utils/time';
import { CoreUtils } from '@services/utils/utils';
import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
@ -96,7 +95,7 @@ export class AddonModQuizProvider {
return Translate.instant('addon.mod_quiz.notyetgraded');
}
return CoreUtils.formatFloat(CoreTextUtils.roundToDecimals(grade, decimals));
return CoreUtils.formatFloat(grade.toFixed(decimals ?? 2));
}
/**

View File

@ -33,8 +33,8 @@ Feature: View list of attempts in the app
Given I entered the quiz activity "Quiz 1" on course "Course 1" as "student1" in the app
Then I should find "In progress" within "Attempt 2" "ion-item" in the app
And I should find "Finished" within "Attempt 1" "ion-item" in the app
And I should find "100 / 100" within "Attempt 1" "ion-item" in the app
But I should not find "100" within "Attempt 2" "ion-item" in the app
And I should find "100.00 / 100.00" within "Attempt 1" "ion-item" in the app
But I should not find "100.00" within "Attempt 2" "ion-item" in the app
And I should not find "Started" within "Your attempts" "ion-card" in the app
And I should not find "Completed" within "Your attempts" "ion-card" in the app
And I should not find "Marks" within "Your attempts" "ion-card" in the app
@ -43,7 +43,7 @@ Feature: View list of attempts in the app
When I press "Attempt 1" in the app
Then I should find "Started" within "Your attempts" "ion-card" in the app
And I should find "Completed" in the app
And I should find "1/1" within "Marks" "ion-item" in the app
And I should find "1.00/1.00" within "Marks" "ion-item" in the app
And I should be able to press "Review" in the app
@lms_from4.2
@ -51,7 +51,7 @@ Feature: View list of attempts in the app
Given the attempt at "Quiz 1" by "student1" was never submitted
And I entered the quiz activity "Quiz 1" on course "Course 1" as "student1" in the app
Then I should find "Never submitted" within "Attempt 2" "ion-item" in the app
But I should not find "100" within "Attempt 2" "ion-item" in the app
But I should not find "100.00" within "Attempt 2" "ion-item" in the app
When I press "Attempt 2" in the app
Then I should find "Started" within "Your attempts" "ion-card" in the app

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 37 KiB