diff --git a/src/addons/mod/quiz/services/quiz.ts b/src/addons/mod/quiz/services/quiz.ts index e360df44c..44a948489 100644 --- a/src/addons/mod/quiz/services/quiz.ts +++ b/src/addons/mod/quiz/services/quiz.ts @@ -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)); } /** diff --git a/src/addons/mod/quiz/tests/behat/attempts_list.feature b/src/addons/mod/quiz/tests/behat/attempts_list.feature index dea9c5de4..6d8e70a8f 100644 --- a/src/addons/mod/quiz/tests/behat/attempts_list.feature +++ b/src/addons/mod/quiz/tests/behat/attempts_list.feature @@ -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 diff --git a/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_40.png b/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_40.png index 679b91517..74d4c6b57 100644 Binary files a/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_40.png and b/src/addons/mod/quiz/tests/behat/snapshots/attempt-a-quiz-in-app-submit-a-quiz--review-a-quiz-attempt_40.png differ