Song reporting and user stats

This commit is contained in:
Olaf Slomp
2018-12-14 16:59:44 +01:00
committed by Daan Sprenkels
parent 0c1f9cb08d
commit f6fcc63450
17 changed files with 381 additions and 47 deletions

View File

@ -26,7 +26,7 @@
<tr>
<th>#</th>
<th>User</th>
<th>#&nbsp;Songs</th>
<th># Songs</th>
</tr>
</thead>
<tbody>
@ -51,7 +51,7 @@
<tr>
<th>#</th>
<th>User</th>
<th>#&nbsp;Requests</th>
<th># Requests</th>
</tr>
</thead>
<tbody>
@ -67,7 +67,7 @@
</div>
</div>
<div class="col-md-6">
<h2>Time Requested</h2>
<h2>Time requested</h2>
<h4>Total: {{stats.total_time_requested}}</h4>
<h4>Top {{ stats.stats_top_count }}:</h4>
<div class="table-responsive">
@ -93,7 +93,7 @@
</div>
<div class="col-md-6">
<h2>Unique requests</h2>
<h4>Total: {{stats.total_unique_requests}}</h4>
<h4>Total: {{stats.total_unique_requests.total}}</h4>
<h4>Top {{ stats.stats_top_count }}:</h4>
<div class="table-responsive">
<table class="table table-striped">
@ -101,7 +101,7 @@
<tr>
<th>#</th>
<th>User</th>
<th>#&nbsp;Requests</th>
<th># Unique</th>
</tr>
</thead>
<tbody>
@ -109,7 +109,7 @@
<tr>
<th>{{ forloop.counter }}</th>
<td>{{ stat.user__name }}</td>
<td>{{ stat.total }} ({{ stat.ratio }}%)</td>
<td>{{ stat.unique_requests }} ({% widthratio stat.unique_requests stat.total_requests 100 %}%)</td>
</tr>
{% endfor %}
</tbody>
@ -126,7 +126,7 @@
<th>#</th>
<th>Artist</th>
<th>Title</th>
<th>#&nbsp;Requests</th>
<th># Requests</th>
</tr>
</thead>
<tbody>
@ -141,6 +141,30 @@
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h2>Most played uploaders</h2>
<h4>Top {{ stats.stats_top_count }}:</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>User</th>
<th># Songs</th>
</tr>
</thead>
<tbody>
{% for stat in stats.most_requested_uploaders %}
<tr>
<th>{{ forloop.counter }}</th>
<td>{{ stat.song__user__name }}</td>
<td>{{ stat.total }} ({% widthratio stat.total stats.total_requests 100 %}%)</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h2>Most played songs last 14 days</h2>
@ -152,7 +176,7 @@
<th>#</th>
<th>Artist</th>
<th>Title</th>
<th>#&nbsp;Requests</th>
<th># Requests</th>
</tr>
</thead>
<tbody>

View File

@ -0,0 +1,99 @@
{% extends 'base.html' %}
{% load static %}
{% load tz %}
{% block title %}User Stats{% endblock %}
{% block content %}
<h1>User Statistics</h1>
<div class="row">
{% if current_age_text %}
<div class="alert alert-info">
<strong>{{ current_age_text }}</strong>
{% endif %}
</div>
<h4>Total uploads: {{ stats.total_uploads }}</h4>
<h4>Total requests: {{ stats.total_requests }}</h4>
<h4>Unique requests: {{ stats.unique_requests }} ({% widthratio stats.unique_requests stats.total_requests 100 %}%)</h4>
<h4>Total requested uploads: {{stats.total_played_uploads}}</h4>
<div class="col-md-6">
<h2>Most played songs</h2>
<h4>Top {{ stats.stats_top_count }}:</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Artist</th>
<th>Title</th>
<th># Requests</th>
</tr>
</thead>
<tbody>
{% for stat in stats.most_played_songs %}
<tr>
<th>{{ forloop.counter }}</th>
<td>{{ stat.song__artist }}</td>
<td>{{ stat.song__title }}</td>
<td>{{ stat.total }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h2>Most played uploads</h2>
<h4>Top {{ stats.stats_top_count }}:</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Artist</th>
<th>Title</th>
<th># Requests</th>
</tr>
</thead>
<tbody>
{% for stat in stats.most_played_uploads %}
<tr>
<th>{{ forloop.counter }}</th>
<td>{{ stat.song__artist }}</td>
<td>{{ stat.song__title }}</td>
<td>{{ stat.total }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h2>Most played uploaders</h2>
<h4>Top {{ stats.stats_top_count }}:</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Uploader</th>
<th># Requests</th>
</tr>
</thead>
<tbody>
{% for stat in stats.most_played_uploaders %}
<tr>
<th>{{ forloop.counter }}</th>
<td>{{ stat.song__user__name }}</td>
<td>{{ stat.total }} ({% widthratio stat.total total_requests 100 %}%)</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endblock %}