work on monitor

This commit is contained in:
jeffrey
2016-11-26 17:32:30 +01:00
parent 7e571a6794
commit aa1c21a8c8
38 changed files with 412 additions and 160 deletions

View File

@ -7,80 +7,79 @@
{% endblock %}
{% block content %}
<div id='content'>
<h1>{% trans "Statistics of the stations" %}</h1>
<header>
<h1>{% trans "Statistics of the stations" %}</h1>
{# TODO here #}
<form action="?" method="GET">
Go to this date:
<input name="day" type="number" placeholder="{% trans "day" %}"
value="{{ statistics.0.date.day }}"></input>
<input name="month" type="number" placeholder="{% trans "month" %}"
value="{{ statistics.0.date.month }}"></input>
<input name="year" type="number" placeholder="{% trans "year" %}"
value="{{ statistics.0.date.year }}"></input>
<button type="submit">Show</button>
</form>
{# TODO here #}
<form action="?" method="GET">
Go to this date:
<input name="day" type="number" placeholder="{% trans "day" %}"
value="{{ statistics.0.date.day }}"></input>
<input name="month" type="number" placeholder="{% trans "month" %}"
value="{{ statistics.0.date.month }}"></input>
<input name="year" type="number" placeholder="{% trans "year" %}"
value="{{ statistics.0.date.year }}"></input>
<input type="submit" value="{% trans "Show" %}">
</form>
</header>
{% for stats in statistics %}
<section class="station">
<header>
<h2>{{ stats.station.name }},
{{ stats.date|date:'l d F Y' }}</h2>
</header>
{% for stats in statistics %}
<section class="station">
<header>
<h2>{{ stats.station.name }},
{{ stats.date|date:'l d F Y' }}</h2>
</header>
<table cellspacing="0" cellpading="0" class="object">
<tr class="header">
<th>{% trans "Date" %}</th>
<th width="10%">{% trans "Type" %}
{# Translators "Header for statistics view" #}
<th width="50%">{% trans "Diffusion or sound played" %}
<th width="30%">{% trans "Tags" %}</th>
<table cellspacing="0" cellpadding="0" class="object">
<tr class="header">
<th>{% trans "Date" %}</th>
<th width="10%">{% trans "Type" %}
{# Translators "Header for statistics view" #}
<th width="50%">{% trans "Diffusion or sound played" %}
<th width="30%">{% trans "Tags" %}</th>
</tr>
{% for item in stats.items %}
<tr>
<th>{{ item.date|time:"H:i" }}</th>
<th>{{ item.type }}</th>
<th>{{ item.name }}</th>
<th>{% for tag,count in item.tags.items %}
{{ tag }}: {{ count }};
{% endfor %}</th>
</tr>
{% for item in stats.items %}
<tr>
<th>{{ item.date|time:"H:i" }}</th>
<th>{{ item.type }}</th>
<th>{{ item.name }}</th>
<th>{% for tag,count in item.tags.items %}
{{ tag }}: {{ count }};
{% endfor %}</th>
</tr>
{% for track in item.tracks %}
<tr class="subdata">
<td>{{ track.date|time:"H:i" }}</td>
<td>{% trans "Track" %}</td>
<td>{{ track.artist }} -- <emph>{{ track.title }}</emph> {{ track.version }}</td>
<td>{{ track.tags.all|join:', ' }}</td>
</tr>
{% endfor %}
{% for track in item.tracks %}
<tr class="subdata">
<td>{{ track.date|time:"H:i" }}</td>
<td>{% trans "Track" %}</td>
<td>{{ track.artist }} -- <emph>{{ track.title }}</emph> {{ track.version }}</td>
<td>{{ track.tags.all|join:', ' }}</td>
</tr>
{% endfor %}
{% endfor %}
<tr class="bottom">
<th>{{ stats.date|date:'d/m/Y' }}</th>
<th>{% trans "Total" %}</th>
{# TODO: translation block #}
<th>
{% with stats.items|length as items_count %}
{% with stats.count as tracks_count %}
{% blocktrans %}
{{ items_count }} items, with a total of {{ tracks_count }} tracks
{% endblocktrans %}
{% endwith %}
{% endwith %}
</th>
<th>{% for tag, count, average in stats.tags %}
<span>{{ tag }}: <b>{{ average|floatformat }}%</b> ({{ count }})<br>
{% endfor %}
</th>
</tr>
</table>
</section>
{% endfor %}
</div>
<tr class="bottom">
<th>{{ stats.date|date:'d/m/Y' }}</th>
<th>{% trans "Total" %}</th>
<th>
{% with stats.items|length as items_count %}
{% with stats.count as tracks_count %}
{% blocktrans %}
{{ items_count }} items, with a total of {{ tracks_count }} tracks
{% endblocktrans %}
{% endwith %}
{% endwith %}
</th>
<th>{% for tag, count, average in stats.tags %}
<span>{{ tag }}: <b>{{ average|floatformat }}%</b> ({{ count }})<br>
{% endfor %}
</th>
</tr>
</table>
</section>
{% endfor %}
{% endblock %}