From d575bfa0fb1334cf1f6ab2343aeccad072337c5e Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 25 Aug 2025 09:19:03 +0530 Subject: [PATCH] feat: streak details --- cypress/e2e/course_creation.cy.js | 2 +- frontend/src/pages/Home/Home.vue | 9 +++- frontend/src/pages/Home/Streak.vue | 79 ++++++++++++++++++++++++++++++ lms/lms/utils.py | 6 +-- 4 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 frontend/src/pages/Home/Streak.vue diff --git a/cypress/e2e/course_creation.cy.js b/cypress/e2e/course_creation.cy.js index a48a868b..f50acd03 100644 --- a/cypress/e2e/course_creation.cy.js +++ b/cypress/e2e/course_creation.cy.js @@ -98,7 +98,7 @@ describe("Course Creation", () => { // View Course cy.wait(1000); - cy.visit("/lms"); + cy.visit("/lms/courses"); cy.closeOnboardingModal(); cy.url().should("include", "/lms/courses"); diff --git a/frontend/src/pages/Home/Home.vue b/frontend/src/pages/Home/Home.vue index 1ca0fc64..c5a8216a 100644 --- a/frontend/src/pages/Home/Home.vue +++ b/frontend/src/pages/Home/Home.vue @@ -16,7 +16,11 @@
-
+
🔥 {{ streakInfo.data?.current_streak }} @@ -32,6 +36,7 @@ />
+ diff --git a/lms/lms/utils.py b/lms/lms/utils.py index a14d0326..0ffb24f3 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -2400,7 +2400,7 @@ def get_streak_info(): all_dates = sorted(all_dates) streak = 0 - max_streak = 0 + longest_streak = 0 prev_day = None for d in all_dates: @@ -2423,10 +2423,10 @@ def get_streak_info(): else: streak = 1 - max_streak = max(max_streak, streak) + longest_streak = max(longest_streak, streak) prev_day = d return { "current_streak": streak, - "max_streak": max_streak, + "longest_streak": longest_streak, }