From 67af17e8164d79e19a5ba3907b124d9f46bcee69 Mon Sep 17 00:00:00 2001 From: Eshaan Aggarwal <96648934+EshaanAgg@users.noreply.github.com> Date: Fri, 1 Mar 2024 18:49:53 +0530 Subject: [PATCH] Revert "fix: address review comments" as it was for a different branch This reverts commit d6c473e295f1e0bf5e76c8b58bcd533b453174f5. --- .../core/assets/src/views/ExamReport/TriesOverview.vue | 8 +++----- .../src/views/ExamReport/__tests__/TriesOverview.spec.js | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/kolibri/core/assets/src/views/ExamReport/TriesOverview.vue b/kolibri/core/assets/src/views/ExamReport/TriesOverview.vue index 55c8b4d3ae..83a3b85a4f 100644 --- a/kolibri/core/assets/src/views/ExamReport/TriesOverview.vue +++ b/kolibri/core/assets/src/views/ExamReport/TriesOverview.vue @@ -126,11 +126,9 @@ return this.pastTries.length ? Math.max(...this.pastTries.map(t => t.correct)) : null; }, bestScore() { - const bestScoreAttempt = this.pastTries.find(t => t.correct === this.maxQuestionsCorrect); - if (!bestScoreAttempt) { - return null; - } - return bestScoreAttempt.time_spent; + return this.maxQuestionsCorrect !== null + ? this.maxQuestionsCorrect / this.totalQuestions + : null; }, suggestedTimeAnnotation() { if (!this.suggestedTime || this.bestTimeSpent === null) { diff --git a/kolibri/core/assets/src/views/ExamReport/__tests__/TriesOverview.spec.js b/kolibri/core/assets/src/views/ExamReport/__tests__/TriesOverview.spec.js index 83066bc85b..05acce0b77 100644 --- a/kolibri/core/assets/src/views/ExamReport/__tests__/TriesOverview.spec.js +++ b/kolibri/core/assets/src/views/ExamReport/__tests__/TriesOverview.spec.js @@ -59,7 +59,7 @@ describe('TriesOverview', () => { }); test('renders progress icon and not started label when there are no past tries', () => { - renderComponent({ pastTries: [] }); + renderComponent(); expect(screen.getByTestId('progress-icon-0')).toBeInTheDocument(); expect(screen.getByText('notStartedLabel')).toBeInTheDocument();