Added stats for the last week.
This commit is contained in:
parent
3937b92835
commit
16d02437f9
@ -24,6 +24,11 @@ class ServerDetailView(generic.DetailView):
|
||||
context['daily_min'] = min(tmp)
|
||||
context['daily_max'] = max(tmp)
|
||||
|
||||
tmp = [players for time, players in points[-96*7:]]
|
||||
context['weekly_average'] = sum(tmp) / float(len(tmp))
|
||||
context['weekly_min'] = min(tmp)
|
||||
context['weekly_max'] = max(tmp)
|
||||
|
||||
tmp = [players for time, players in points]
|
||||
context['total_average'] = sum(tmp) / float(len(tmp))
|
||||
context['total_min'] = min(tmp)
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Time period</th>
|
||||
<th>Average</th>
|
||||
<th>Min</th>
|
||||
<th>Max</th>
|
||||
@ -34,11 +34,17 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Daily</th>
|
||||
<th>Last day</th>
|
||||
<th>{{daily_average|floatformat}}</th>
|
||||
<th>{{daily_min}}</th>
|
||||
<th>{{daily_max}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Last week</th>
|
||||
<th>{{weekly_average|floatformat}}</th>
|
||||
<th>{{weekly_min}}</th>
|
||||
<th>{{weekly_max}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th>{{total_average|floatformat}}</th>
|
||||
@ -49,15 +55,14 @@
|
||||
|
||||
<div id="chart"></div>
|
||||
<div id="tooltip"></div>
|
||||
|
||||
<script type="text/javascript" src="{% static 'js/jquery.min.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/jquery.flot.js' %}"></script>
|
||||
<script type="text/javascript" src="{% static 'js/jquery.flot.time.js' %}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var series = [
|
||||
{% for timestamp, players in player_history %}
|
||||
{# convert timestamp to ms, because javascript... #}
|
||||
{% for timestamp, players in player_history %}
|
||||
[{{timestamp|date:'U'}} * 1000, {{players}}],
|
||||
{% endfor %}
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user