aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvolpino <fox91@anche.no>2012-11-26 14:32:39 +0100
committervolpino <fox91@anche.no>2012-11-26 14:32:39 +0100
commit8ad3ed28973c941c2ef89e33838e4835f3cc8e72 (patch)
tree6d7db4976e126c30e216f0b18b5e5c9942e600b3
parenteuscanwww: moving "Statistics" at the bottom of the menu bar (diff)
downloadeuscan-8ad3ed28973c941c2ef89e33838e4835f3cc8e72.tar.gz
euscan-8ad3ed28973c941c2ef89e33838e4835f3cc8e72.tar.bz2
euscan-8ad3ed28973c941c2ef89e33838e4835f3cc8e72.zip
euscanwww: Handler's statistics
Signed-off-by: volpino <fox91@anche.no>
-rw-r--r--euscanwww/djeuscan/templates/euscan/statistics.html24
-rw-r--r--euscanwww/djeuscan/views.py10
2 files changed, 33 insertions, 1 deletions
diff --git a/euscanwww/djeuscan/templates/euscan/statistics.html b/euscanwww/djeuscan/templates/euscan/statistics.html
index 8217576..f3866d9 100644
--- a/euscanwww/djeuscan/templates/euscan/statistics.html
+++ b/euscanwww/djeuscan/templates/euscan/statistics.html
@@ -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' %}" />
diff --git a/euscanwww/djeuscan/views.py b/euscanwww/djeuscan/views.py
index da3bcac..39d2fae 100644
--- a/euscanwww/djeuscan/views.py
+++ b/euscanwww/djeuscan/views.py
@@ -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):