[widgets] Fix music aggregator
This commit is contained in:
@ -86,12 +86,18 @@ def live_charts(
|
|||||||
app_label: str = "music",
|
app_label: str = "music",
|
||||||
as_of: datetime = None,
|
as_of: datetime = None,
|
||||||
) -> QuerySet:
|
) -> QuerySet:
|
||||||
now = as_of if as_of else timezone.now()
|
if as_of is not None:
|
||||||
tzinfo = now.tzinfo
|
now = as_of
|
||||||
now = now.date()
|
|
||||||
if user.is_authenticated and not as_of:
|
|
||||||
now = now_user_timezone(user.profile)
|
|
||||||
tzinfo = now.tzinfo
|
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)
|
seven_days_ago = now - timedelta(days=7)
|
||||||
thirty_days_ago = now - timedelta(days=30)
|
thirty_days_ago = now - timedelta(days=30)
|
||||||
|
|||||||
@ -1012,14 +1012,14 @@ class EmbeddableTopArtistsWidget(TemplateView):
|
|||||||
parsed_date = None
|
parsed_date = None
|
||||||
|
|
||||||
if parsed_date:
|
if parsed_date:
|
||||||
now = parsed_date
|
now = datetime.combine(parsed_date, datetime.min.time())
|
||||||
|
now = timezone.make_aware(now)
|
||||||
else:
|
else:
|
||||||
now = timezone.now().date()
|
now = timezone.now()
|
||||||
else:
|
else:
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
if user.is_authenticated:
|
if user.is_authenticated:
|
||||||
now = now_user_timezone(user.profile)
|
now = now_user_timezone(user.profile)
|
||||||
now = now.date()
|
|
||||||
|
|
||||||
period = self.kwargs.get("period", "week")
|
period = self.kwargs.get("period", "week")
|
||||||
if period == "month":
|
if period == "month":
|
||||||
|
|||||||
Reference in New Issue
Block a user