mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 09:12:23 +01:00
More statistics on the stats page.
This commit is contained in:
committed by
Daan Sprenkels
parent
5ce5dc5587
commit
cbc9284865
@ -5,46 +5,54 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Statistics</h1>
|
<h1>Statistics</h1>
|
||||||
<h2>Uploads</h2>
|
<div class="row">
|
||||||
<div class="table-responsive">
|
<div class="col-md-6">
|
||||||
<table class="table table-striped">
|
<h2>Uploads</h2>
|
||||||
<thead>
|
<h4>Total: {{ total_uploads }}</h4>
|
||||||
<tr>
|
<div class="table-responsive">
|
||||||
<th>#</th>
|
<table class="table table-striped">
|
||||||
<th>User</th>
|
<thead>
|
||||||
<th># Songs</th>
|
<tr>
|
||||||
</tr>
|
<th>#</th>
|
||||||
</thead>
|
<th>User</th>
|
||||||
<tbody>
|
<th># Songs</th>
|
||||||
{% for stat in upload_stats %}
|
</tr>
|
||||||
<tr>
|
</thead>
|
||||||
<th>{{ forloop.counter }}</th>
|
<tbody>
|
||||||
<td>{{ stat.user__name }}</td>
|
{% for stat in upload_stats %}
|
||||||
<td>{{ stat.total }}</td>
|
<tr>
|
||||||
</tr>
|
<th>{{ forloop.counter }}</th>
|
||||||
{% endfor %}
|
<td>{{ stat.user__name }}</td>
|
||||||
</tbody>
|
<td>{{ stat.total }} ({% widthratio stat.total total_uploads 100 %}%)</td>
|
||||||
</table>
|
</tr>
|
||||||
</div>
|
{% endfor %}
|
||||||
<h2>Requests</h2>
|
</tbody>
|
||||||
<div class="table-responsive">
|
</table>
|
||||||
<table class="table table-striped">
|
</div>
|
||||||
<thead>
|
</div>
|
||||||
<tr>
|
<div class="col-md-6">
|
||||||
<th>#</th>
|
<h2>Requests</h2>
|
||||||
<th>User</th>
|
<h4>Total: {{ total_requests }}</h4>
|
||||||
<th># Requests</th>
|
<div class="table-responsive">
|
||||||
</tr>
|
<table class="table table-striped">
|
||||||
</thead>
|
<thead>
|
||||||
<tbody>
|
<tr>
|
||||||
{% for stat in request_stats %}
|
<th>#</th>
|
||||||
<tr>
|
<th>User</th>
|
||||||
<th>{{ forloop.counter }}</th>
|
<th># Requests</th>
|
||||||
<td>{{ stat.user__name }}</td>
|
</tr>
|
||||||
<td>{{ stat.total }}</td>
|
</thead>
|
||||||
</tr>
|
<tbody>
|
||||||
{% endfor %}
|
{% for stat in request_stats %}
|
||||||
</tbody>
|
<tr>
|
||||||
</table>
|
<th>{{ forloop.counter }}</th>
|
||||||
|
<td>{{ stat.user__name }}</td>
|
||||||
|
<td>{{ stat.total }} ({% widthratio stat.total total_requests 100 %}%)</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -5,6 +5,11 @@ from queues.models import PlaylistSong
|
|||||||
|
|
||||||
|
|
||||||
def stats(request):
|
def stats(request):
|
||||||
upload_stats = Song.objects.all().exclude(user_id=None).values('user__name').annotate(total=Count('id')).order_by('-total')
|
total_uploads = Song.objects.all().filter(deleted=False).exclude(user_id=None).count()
|
||||||
request_stats = PlaylistSong.objects.all().exclude(user_id=None).values('user__name').annotate(total=Count('id')).order_by('-total')
|
upload_stats = Song.objects.all().filter(deleted=False).exclude(user_id=None).values('user__name')\
|
||||||
return render(request, 'stats/stats.html', {'upload_stats': upload_stats, 'request_stats': request_stats})
|
.annotate(total=Count('id')).order_by('-total')
|
||||||
|
total_requests = PlaylistSong.objects.all().filter(state=2).exclude(user_id=None).count()
|
||||||
|
request_stats = PlaylistSong.objects.all().filter(state=2).exclude(user_id=None).values('user__name')\
|
||||||
|
.annotate(total=Count('id')).order_by('-total')
|
||||||
|
return render(request, 'stats/stats.html', {'total_uploads': total_uploads, 'upload_stats': upload_stats,
|
||||||
|
'total_requests': total_requests, 'request_stats': request_stats})
|
||||||
|
|||||||
Reference in New Issue
Block a user