From 0b41d90835bfdc136e4f0cc564ff50ea54def02a Mon Sep 17 00:00:00 2001 From: SahilDhillon21 Date: Fri, 27 Dec 2024 20:34:17 +0530 Subject: [PATCH 1/2] Visual streak tracker --- website/models.py | 6 +++--- website/templates/profile.html | 33 +++++++++++++++++++++++++++++++++ website/views/user.py | 12 +++++++++++- 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/website/models.py b/website/models.py index 1733891b9..74eac77df 100644 --- a/website/models.py +++ b/website/models.py @@ -665,9 +665,9 @@ def update_streak_and_award_points(self, check_in_date=None): elif self.current_streak == 30: points_awarded += 50 reason = "30-day streak milestone achieved!" - elif self.current_streak == 90: + elif self.current_streak == 100: points_awarded += 150 - reason = "90-day streak milestone achieved!" + reason = "100-day streak milestone achieved!" elif self.current_streak == 180: points_awarded += 300 reason = "180-day streak milestone achieved!" @@ -699,7 +699,7 @@ def award_streak_badges(self): 7: "Weekly Streak", 15: "Half-Month Streak", 30: "Monthly Streak", - 90: "Three Month Streak", + 100: "100 Day Streak", 180: "Six Month Streak", 365: "Yearly Streak", } diff --git a/website/templates/profile.html b/website/templates/profile.html index 8281532bc..d3e334312 100644 --- a/website/templates/profile.html +++ b/website/templates/profile.html @@ -284,6 +284,20 @@ color: #ff5722; font-weight: bold; } + .shine-effect { + background: linear-gradient( + 90deg, + transparent, + rgba(255, 255, 255, 0.3), + transparent + ); + animation: shine 2s infinite; + } + + @keyframes shine { + 0% { transform: translateX(-100%); } + 100% { transform: translateX(100%); } + } {% endblock style %} {% block content %} @@ -386,6 +400,25 @@

Last Sizzle Check-in: {{ user.userprofile.last_check_in|default:"N/A" }} +
+
+ Streak Progress +
+ + {{ base_milestone }}/{{ next_milestone }} +
+
+
+
+
+
+
+
+ Current + Next Milestone +
+
diff --git a/website/views/user.py b/website/views/user.py index add5e0aed..68c2f7ea7 100644 --- a/website/views/user.py +++ b/website/views/user.py @@ -219,9 +219,19 @@ def get_context_data(self, **kwargs): user = self.object context = super(UserProfileDetailView, self).get_context_data(**kwargs) + milestones = [7, 15, 30, 100, 180, 365] + base_milestone = 0 + next_milestone = 0 + for milestone in milestones: + if user.userprofile.current_streak >= milestone: + base_milestone = milestone + elif user.userprofile.current_streak < milestone: + next_milestone = milestone + break + context["base_milestone"] = base_milestone + context["next_milestone"] = next_milestone # Fetch badges user_badges = UserBadge.objects.filter(user=user).select_related("badge") - context["user_badges"] = user_badges # Add badges to context context["is_mentor"] = UserBadge.objects.filter(user=user, badge__title="Mentor").exists() context["available_badges"] = Badge.objects.all() From 06920a53f48455ba563b4a4f9487f00213f22bf6 Mon Sep 17 00:00:00 2001 From: SahilDhillon21 Date: Fri, 27 Dec 2024 20:38:52 +0530 Subject: [PATCH 2/2] space --- website/views/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/views/core.py b/website/views/core.py index 4535371c6..5b1267a8f 100644 --- a/website/views/core.py +++ b/website/views/core.py @@ -728,7 +728,7 @@ def view_pr_analysis(request): def home(request): - #last_commit = get_last_commit_date() + # last_commit = get_last_commit_date() return render(request, "home.html", {"last_commit": ""})