mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 07:22:22 +01:00
Small fixes in stats and userstats, changed Most_played_uploads to exclude your own plays
This commit is contained in:
@ -145,16 +145,15 @@ def user_stats(request):
|
||||
'-total')[:settings.STATS_TOP_COUNT]
|
||||
|
||||
most_played_uploads = PlaylistSong.objects.filter(
|
||||
state=2, song_id__in=Song.objects.filter(user__id=request)).exclude(
|
||||
Q(user_id=None)
|
||||
| Q(user_id__in=settings.STATS_REQUEST_IGNORE_USER_IDS)).values(
|
||||
'pk').values(
|
||||
state=2, song_id__in=Song.objects.filter(user__id=request)).exclude(Q(user__id=None)|Q(user__id=request)).values(
|
||||
'song__artist',
|
||||
'song__title').annotate(total=Count('id')).order_by(
|
||||
'-total', 'song__artist',
|
||||
'song__title')[:settings.STATS_TOP_COUNT]
|
||||
|
||||
total_played_uploads = most_played_uploads.aggregate(newtotal=Sum('total'))
|
||||
most_played = list(most_played_uploads)
|
||||
total_played_uploads = 0
|
||||
for x in most_played:
|
||||
total_played_uploads += x['total']
|
||||
|
||||
return {
|
||||
'last_updated': last_updated,
|
||||
@ -165,6 +164,6 @@ def user_stats(request):
|
||||
'most_played_uploaders': list(most_played_uploaders),
|
||||
'most_played_uploads': list(most_played_uploads),
|
||||
'stats_top_count': settings.STATS_TOP_COUNT,
|
||||
'total_played_uploads': total_played_uploads['newtotal'],
|
||||
'total_played_uploads': total_played_uploads,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user