[calendar] Fix bug in query
This commit is contained in:
@ -1368,7 +1368,7 @@ class ScrobbleCalendarView(LoginRequiredMixin, TemplateView):
|
||||
.order_by("timestamp")
|
||||
)
|
||||
|
||||
from django.db.models import Count
|
||||
from django.db.models import Count, Q
|
||||
from django.db.models.functions import TruncDate
|
||||
total_by_day = dict(
|
||||
Scrobble.objects.filter(
|
||||
@ -1376,7 +1376,7 @@ class ScrobbleCalendarView(LoginRequiredMixin, TemplateView):
|
||||
timestamp__date__gte=month_start,
|
||||
timestamp__date__lte=month_end,
|
||||
)
|
||||
.exclude(media_type="GeoLocation", title__isnull=True)
|
||||
.exclude(Q(media_type="GeoLocation") & Q(geo_location__title__isnull=True))
|
||||
.annotate(local_date=TruncDate("timestamp", tzinfo=timezone.get_current_timezone()))
|
||||
.values("local_date")
|
||||
.annotate(count=Count("id"))
|
||||
|
||||
Reference in New Issue
Block a user