mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 21:02:24 +01:00
Limit user stat list size
This commit is contained in:
@ -133,14 +133,16 @@ def user_stats(request):
|
||||
| Q(user_id__in=settings.STATS_REQUEST_IGNORE_USER_IDS)).values(
|
||||
'song__artist',
|
||||
'song__title').annotate(total=Count('id')).order_by(
|
||||
'-total', 'song__artist', 'song__title')
|
||||
'-total', 'song__artist',
|
||||
'song__title')[:settings.STATS_TOP_COUNT]
|
||||
|
||||
most_played_uploaders = PlaylistSong.objects.filter(
|
||||
user__id=request, state=2).exclude(
|
||||
Q(user_id=None)
|
||||
| Q(user_id__in=settings.STATS_REQUEST_IGNORE_USER_IDS)).values(
|
||||
'song__user__id', 'song__user__name').annotate(
|
||||
total=Count('song__user__id')).order_by('-total')
|
||||
total=Count('song__user__id')).order_by(
|
||||
'-total')[:settings.STATS_TOP_COUNT]
|
||||
|
||||
most_played_uploads = PlaylistSong.objects.filter(
|
||||
state=2, song_id__in=Song.objects.filter(user__id=request)).exclude(
|
||||
@ -149,7 +151,8 @@ def user_stats(request):
|
||||
'pk').values(
|
||||
'song__artist',
|
||||
'song__title').annotate(total=Count('id')).order_by(
|
||||
'-total', 'song__artist', 'song__title')
|
||||
'-total', 'song__artist',
|
||||
'song__title')[:settings.STATS_TOP_COUNT]
|
||||
|
||||
total_played_uploads = most_played_uploads.aggregate(newtotal=Sum('total'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user