From 59aac915a253dce4c6984373cf27d26229f60e73 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 18 Apr 2024 12:21:17 +0200 Subject: [PATCH] MOBILE-4553 quiz: Hide ungraded marks This makes it consistent with the way it works in the LMS, we're also relying on attempt.sumgrades because grade item marks are never null. See MDL-81599. --- src/addons/mod/quiz/pages/attempt/attempt.html | 4 ++-- src/addons/mod/quiz/pages/review/review.html | 2 +- src/addons/mod/quiz/pages/review/review.ts | 18 +++++++++++------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/addons/mod/quiz/pages/attempt/attempt.html b/src/addons/mod/quiz/pages/attempt/attempt.html index 819d51bb2..5b4692081 100644 --- a/src/addons/mod/quiz/pages/attempt/attempt.html +++ b/src/addons/mod/quiz/pages/attempt/attempt.html @@ -30,7 +30,7 @@

{{ sentence }}

- +

{{ gradeItemMark.name }} / {{ gradeItemMark.maxgrade }}

@@ -38,7 +38,7 @@
- +

{{ 'addon.mod_quiz.marks' | translate }} / {{ quiz!.sumGradesFormatted }}

{{ attempt.readableMark }}

diff --git a/src/addons/mod/quiz/pages/review/review.html b/src/addons/mod/quiz/pages/review/review.html index 7a8ffb9ce..4fa9412b2 100644 --- a/src/addons/mod/quiz/pages/review/review.html +++ b/src/addons/mod/quiz/pages/review/review.html @@ -60,7 +60,7 @@

{{ gradeItemMark.grade }}

- +

{{ 'addon.mod_quiz.marks' | translate }}

{{ readableMark }}

diff --git a/src/addons/mod/quiz/pages/review/review.ts b/src/addons/mod/quiz/pages/review/review.ts index 90dddd231..188a756e6 100644 --- a/src/addons/mod/quiz/pages/review/review.ts +++ b/src/addons/mod/quiz/pages/review/review.ts @@ -286,13 +286,17 @@ export class AddonModQuizReviewPage implements OnInit { } // Treat grade item marks. - this.gradeItemMarks = this.attempt.gradeitemmarks?.map((gradeItemMark) => ({ - name: gradeItemMark.name, - grade: Translate.instant('addon.mod_quiz.outof', { $a: { - grade: AddonModQuiz.formatGrade(gradeItemMark.grade, this.quiz?.decimalpoints), - maxgrade: AddonModQuiz.formatGrade(gradeItemMark.maxgrade, this.quiz?.decimalpoints), - } }), - })) ?? []; + if (this.attempt.sumgrades === null || !this.attempt.gradeitemmarks) { + this.gradeItemMarks = []; + } else { + this.gradeItemMarks = this.attempt.gradeitemmarks.map((gradeItemMark) => ({ + name: gradeItemMark.name, + grade: Translate.instant('addon.mod_quiz.outof', { $a: { + grade: AddonModQuiz.formatGrade(gradeItemMark.grade, this.quiz?.decimalpoints), + maxgrade: AddonModQuiz.formatGrade(gradeItemMark.maxgrade, this.quiz?.decimalpoints), + } }), + })); + } // Treat grade. if (this.options && this.options.someoptions.marks >= AddonModQuizProvider.QUESTION_OPTIONS_MARK_AND_MAX &&