1 Commits

Author SHA1 Message Date
371334326b quickfix artist stat 2020-03-28 15:12:09 +01:00

View File

@ -109,8 +109,8 @@ def compute_stats():
stats['most_played_artists'] = PlaylistSong.objects.filter(state=2).exclude(
Q(user_id=None)
| Q(user_id__in=settings.STATS_REQUEST_IGNORE_USER_IDS)).values(
'song__artist__id', 'song__artist__name').annotate(total=Count('song__artist__id')).order_by(
'-total', 'song__artist__name')[:settings.STATS_TOP_COUNT]
'song__artist').annotate(total=Count('song__artist')).order_by(
'-total', 'song__artist')[:settings.STATS_TOP_COUNT]
stats['most_played_songs_14_days'] = PlaylistSong.objects.filter(
state=2, played_at__gte=timezone.now() -
@ -171,6 +171,7 @@ def compute_stats():
'unique_request_stats': list(stats['unique_request_stats']),
'total_unique_requests': "{0:,.0f}".format(stats['total_unique_requests']['total']),
'most_played_songs': list(stats['most_played_songs']),
'most_played_artists': list(stats['most_played_artists']),
'most_played_songs_14_days': list(stats['most_played_songs_14_days']),
'time_requested': stats['time_requested'],
'total_time_requested': str(round(float(