From dcbb859a259082bf8d0587a63385ece44c697e45 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 23 Jun 2011 20:13:01 -0500 Subject: Add (hidden) ability to search by last packager This is used from the developer dashboard to add a new column to the stats of # of packages for a given developer where they were the last to do the packaging. Signed-off-by: Dan McGee --- devel/views.py | 2 ++ packages/views.py | 10 ++++++++++ templates/devel/index.html | 41 ++++++++++++++++++++++++++++------------- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/devel/views.py b/devel/views.py index 1827f2a..4399b73 100644 --- a/devel/views.py +++ b/devel/views.py @@ -50,9 +50,11 @@ def index(request): total_orphans = Package.objects.exclude(pkgbase__in=maintained).count() total_flagged_orphans = Package.objects.filter( flag_date__isnull=False).exclude(pkgbase__in=maintained).count() + total_updated = Package.objects.filter(packager__isnull=True).count() orphan = { 'package_count': total_orphans, 'flagged_count': total_flagged_orphans, + 'updated_count': total_updated, } page_dict = { diff --git a/packages/views.py b/packages/views.py index 7b8c2e6..02b9f93 100644 --- a/packages/views.py +++ b/packages/views.py @@ -191,6 +191,7 @@ class PackageSearchForm(forms.Form): arch = forms.MultipleChoiceField(required=False) q = forms.CharField(required=False) maintainer = forms.ChoiceField(required=False) + packager = forms.ChoiceField(required=False) last_update = forms.DateField(required=False, widget=AdminDateWidget(), label='Last Updated After') flagged = forms.ChoiceField( @@ -213,6 +214,9 @@ class PackageSearchForm(forms.Form): self.fields['maintainer'].choices = \ [('', 'All'), ('orphan', 'Orphan')] + \ [(m.username, m.get_full_name()) for m in maints] + self.fields['packager'].choices = \ + [('', 'All'), ('unknown', 'Unknown')] + \ + [(m.username, m.get_full_name()) for m in maints] def search(request, page=None): limit = 50 @@ -237,6 +241,12 @@ def search(request, page=None): user__username=form.cleaned_data['maintainer']).values('pkgbase') packages = packages.filter(pkgbase__in=inner_q) + if form.cleaned_data['packager'] == 'unknown': + packages = packages.filter(packager__isnull=True) + elif form.cleaned_data['packager']: + packages = packages.filter( + packager__username=form.cleaned_data['packager']) + if form.cleaned_data['flagged'] == 'Flagged': packages = packages.filter(flag_date__isnull=False) elif form.cleaned_data['flagged'] == 'Not Flagged': diff --git a/templates/devel/index.html b/templates/devel/index.html index 2a0058d..f9ca213 100644 --- a/templates/devel/index.html +++ b/templates/devel/index.html @@ -182,10 +182,10 @@ {# dash-by-arch #} {% endcache %} -{% cache 60 dev-dash-by-maintainer %} -
+{% cache 60 dev-dash-by-developer %} +
-

Stats by Maintainer

+

Stats by Developer

{% if perms.main.change_package %}

Look for stale relations

@@ -195,17 +195,24 @@ Maintainer - # Packages + # Maintained # Flagged + # Last Packager - Orphan + Orphan/Unknown - {{ orphan.package_count }} packages + {{ orphan.package_count }} packages + - {{ orphan.flagged_count }} packages + {{ orphan.flagged_count }} packages + + + {{ orphan.updated_count }} packages + @@ -214,15 +221,21 @@ {{ maint.get_full_name }} - {{ maint.package_count }} packages + {{ maint.package_count }} packages + - {{ maint.flagged_count }} packages + {{ maint.flagged_count }} packages + + + {{ maint.updated_count }} packages + {% endfor %} -
{# #dash-by-maintainer #} +
{# #dash-by-developer #} {% endcache %} {% load cdn %}{% jquery %} @@ -236,9 +249,11 @@ $(document).ready(function() { {widgets: ['zebra'], sortList: [[0,0], [1,0]]}); $("#dash-todo:not(:has(tbody tr.empty))").tablesorter( {widgets: ['zebra'], sortList: [[1,1]]}); - $(".dash-stats").tablesorter( - {widgets: ['zebra'], sortList: [[0,0]], - headers: { 1: { sorter: 'pkgcount' }, 2: { sorter: 'pkgcount' } } }); + $(".dash-stats").tablesorter({ + widgets: ['zebra'], + sortList: [[0,0]], + headers: { 1: { sorter: 'pkgcount' }, 2: { sorter: 'pkgcount' }, 3: { sorter: 'pkgcount' } } + }); }); {% endblock %} -- cgit v1.2.3-24-g4f1b