euscanwww: Handler's statistics

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-11-26 14:32:39 +01:00
parent 1af51ec674
commit 8ad3ed2897
2 changed files with 33 additions and 1 deletions

View File

@ -5,6 +5,30 @@
{% block content %}
<h2>Statistics</h2>
<hr>
<h3>Handlers</h3>
<table class="table">
<thead>
<tr>
<th></th>
<th># of found versions</th>
<th>average confidence</th>
</tr>
</thead>
<tbody>
{% for handler in handlers %}
<tr>
<td>{{ handler.handler }}</td>
<td>{{ handler.n }}</td>
<td>{{ handler.avg_conf }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<hr>
<h3>Current statistics</h3>
<img alt="pie versions" src="{% url "chart" 'pie-versions' %}" />
<img alt="pie packages" src="{% url "chart" 'pie-packages' %}" />

View File

@ -8,6 +8,7 @@ from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from django.db import models
from djeuscan.helpers import version_key, packages_from_names, \
get_maintainer_or_404, get_make_conf, get_layman_repos, versiontag_to_attrs
@ -376,7 +377,14 @@ def config(request):
@render_to("euscan/statistics.html")
def statistics(request):
return {}
handlers = (
Version.objects.values("handler", "confidence")
.filter(overlay="")
.annotate(n=models.Count("handler"),
avg_conf=models.Avg("confidence"))
.order_by("-n")
)
return {"handlers": handlers}
def chart(request, **kwargs):