From 3c1130071b2780dcbbb6b1fdd5aeee9eb4e261eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 15 Nov 2025 19:01:34 +0000 Subject: [PATCH 1/3] Initial plan From 141093539028274211f5e45c9c276a493cc641fb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 15 Nov 2025 19:04:54 +0000 Subject: [PATCH 2/3] Fix hackathon page view count to match widget display Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com> --- website/views/hackathon.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/website/views/hackathon.py b/website/views/hackathon.py index 723cb11d8e..9689329666 100644 --- a/website/views/hackathon.py +++ b/website/views/hackathon.py @@ -253,13 +253,14 @@ def get_context_data(self, **kwargs): # Get the path for this hackathon hackathon_path = f"/hackathons/{hackathon.slug}/" - # Get the last 14 days of view data + # Get the last 30 days of view data (consistent with the widget) today = timezone.now().date() - fourteen_days_ago = today - timedelta(days=14) + thirty_days_ago = today - timedelta(days=30) # Query IP table for view counts by date + # Use path__contains to match the widget's behavior view_data = ( - IP.objects.filter(path=hackathon_path, created__date__gte=fourteen_days_ago) + IP.objects.filter(path__contains=hackathon_path, created__date__gte=thirty_days_ago) .annotate(date=TruncDate("created")) .values("date") .annotate(count=Sum("count")) @@ -268,7 +269,7 @@ def get_context_data(self, **kwargs): # Prepare data for the sparkline chart date_counts = {item["date"]: item["count"] for item in view_data} - dates, counts = self._get_date_range_data(fourteen_days_ago, today, date_counts) + dates, counts = self._get_date_range_data(thirty_days_ago, today, date_counts) context["view_dates"] = json.dumps(dates) context["view_counts"] = json.dumps(counts) From 28e53dc50d8ea75d32e1fdb1b1713ad483494fb4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 15 Nov 2025 19:25:50 +0000 Subject: [PATCH 3/3] Update hackathon page views to show timeframe-based and all-time stats Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com> --- website/templates/hackathons/detail.html | 5 ++-- website/views/hackathon.py | 30 +++++++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/website/templates/hackathons/detail.html b/website/templates/hackathons/detail.html index c336f6a8b9..4772252aa8 100644 --- a/website/templates/hackathons/detail.html +++ b/website/templates/hackathons/detail.html @@ -64,8 +64,9 @@
{{ merged_pr_count }}
{{ total_views }}
+{{ hackathon_views }}
+All-Time: {{ all_time_views }}