From c5b7e57005967df7156a3ded8cb8f3056996aae9 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Tue, 31 Mar 2026 17:37:06 -0400 Subject: [PATCH] [widgets] Fix music aggregator --- vrobbler/apps/music/aggregators.py | 16 +++++++++++----- vrobbler/apps/scrobbles/views.py | 6 +++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/vrobbler/apps/music/aggregators.py b/vrobbler/apps/music/aggregators.py index 0d8905d..a021328 100644 --- a/vrobbler/apps/music/aggregators.py +++ b/vrobbler/apps/music/aggregators.py @@ -86,12 +86,18 @@ def live_charts( app_label: str = "music", as_of: datetime = None, ) -> QuerySet: - now = as_of if as_of else timezone.now() - tzinfo = now.tzinfo - now = now.date() - if user.is_authenticated and not as_of: - now = now_user_timezone(user.profile) + if as_of is not None: + now = as_of tzinfo = now.tzinfo + now = now.date() + else: + now = timezone.now() + tzinfo = now.tzinfo + now = now.date() + if user.is_authenticated: + now = now_user_timezone(user.profile) + tzinfo = now.tzinfo + now = now.date() seven_days_ago = now - timedelta(days=7) thirty_days_ago = now - timedelta(days=30) diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index 9cb0b88..545cd42 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -1012,14 +1012,14 @@ class EmbeddableTopArtistsWidget(TemplateView): parsed_date = None if parsed_date: - now = parsed_date + now = datetime.combine(parsed_date, datetime.min.time()) + now = timezone.make_aware(now) else: - now = timezone.now().date() + now = timezone.now() else: now = timezone.now() if user.is_authenticated: now = now_user_timezone(user.profile) - now = now.date() period = self.kwargs.get("period", "week") if period == "month":