Big fix to aggregation

This commit is contained in:
2023-02-26 22:21:49 -05:00
parent d5bf6440b0
commit 457afdc9ef
15 changed files with 599 additions and 365 deletions

View File

@ -0,0 +1,19 @@
import pytz
from django.utils import timezone
from scrobbles.models import Scrobble
def now_playing(request):
user = request.user
now = timezone.now()
if user.is_authenticated:
if user.profile:
timezone.activate(pytz.timezone(user.profile.timezone))
now = timezone.localtime(timezone.now())
return {
'now_playing_list': Scrobble.objects.filter(
in_progress=True,
is_paused=False,
user=user,
)
}