From 8ad3ed28973c941c2ef89e33838e4835f3cc8e72 Mon Sep 17 00:00:00 2001 From: volpino Date: Mon, 26 Nov 2012 14:32:39 +0100 Subject: euscanwww: Handler's statistics Signed-off-by: volpino --- .../djeuscan/templates/euscan/statistics.html | 24 ++++++++++++++++++++++ euscanwww/djeuscan/views.py | 10 ++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) 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 %}

Statistics

+
+ +

Handlers

+ + + + + + + + + + {% for handler in handlers %} + + + + + + {% endfor %} + +
# of found versionsaverage confidence
{{ handler.handler }}{{ handler.n }}{{ handler.avg_conf }}
+ +
+

Current statistics

pie versions 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): -- cgit v1.2.3-65-gdbad