mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 22:12:22 +01:00
split uploads in 2 columns
This commit is contained in:
@ -50,8 +50,9 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h2>Uploads requested by others</h2>
|
||||
<h4>Total: {{stats.total_played_uploads}}</h4>
|
||||
<h2>Uploads requested</h2>
|
||||
<h4>Total played by you: {{stats.total_played_user_uploads}}</h4>
|
||||
<h4>Total played by others: {{stats.total_played_uploads}}</h4>
|
||||
<h4>Top {{ stats.stats_top_count }}:</h4>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
@ -60,7 +61,8 @@
|
||||
<th>#</th>
|
||||
<th>Artist</th>
|
||||
<th>Title</th>
|
||||
<th># Requests</th>
|
||||
<th>Others</th>
|
||||
<th>You</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -70,6 +72,7 @@
|
||||
<td>{{ stat.song__artist }}</td>
|
||||
<td>{{ stat.song__title }}</td>
|
||||
<td>{{ stat.total }}</td>
|
||||
<td>{{ stat.user_total }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
@ -145,15 +145,18 @@ 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=request)).values(
|
||||
state=2, song_id__in=Song.objects.filter(user__id=request)).exclude(user__id=None).values(
|
||||
'song__artist',
|
||||
'song__title').annotate(total=Count('id')).order_by(
|
||||
'song__title').annotate(total=Count('id', filter=~Q(user__id=request)), user_total=Count('id', filter=Q(user__id=request))).order_by(
|
||||
'-total', 'song__artist',
|
||||
'song__title')[:settings.STATS_TOP_COUNT]
|
||||
|
||||
most_played = list(most_played_uploads)
|
||||
total_played_uploads = 0
|
||||
total_played_user_uploads = 0
|
||||
for x in most_played:
|
||||
total_played_uploads += x['total']
|
||||
total_played_user_uploads += x['user_total']
|
||||
|
||||
return {
|
||||
'last_updated': last_updated,
|
||||
@ -165,5 +168,6 @@ def user_stats(request):
|
||||
'most_played_uploads': list(most_played_uploads),
|
||||
'stats_top_count': settings.STATS_TOP_COUNT,
|
||||
'total_played_uploads': total_played_uploads,
|
||||
'total_played_user_uploads': total_played_user_uploads,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user