status-report-scripts review-stats.py,1.7,1.8

Jason ティビツ tibbs at fedoraproject.org
Fri Jan 8 00:38:58 UTC 2010


Author: tibbs

Update of /cvs/fedora/status-report-scripts
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20121

Modified Files:
	review-stats.py 
Log Message:
Sort the needsponsor list by the reporter name instead of by date.
Clarify what the green tickets are in the NEW list.



Index: review-stats.py
===================================================================
RCS file: /cvs/fedora/status-report-scripts/review-stats.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- review-stats.py	17 Dec 2009 22:30:29 -0000	1.7
+++ review-stats.py	8 Jan 2010 00:38:28 -0000	1.8
@@ -1,5 +1,5 @@
 #!/usr/bin/python -t
-VERSION = "2.2"
+VERSION = "2.3"
 
 # $Id$
 # Note: This script presently lives in internal git and external cvs.  External
@@ -83,6 +83,13 @@
             return object
     return u''
 
+def reporter(bug):
+    '''Extract the reporter from a bug, replacing an empty value with "(none)".
+    Yes, bugzilla will return a blank reporter for some reason.'''
+    if (bug.reporter) == '':
+        return "(none)"
+    return bug.reporter
+
 def yrmonth(str):
     '''Turn a bugzilla date into Month YYYY string.'''
     m = ['January', 'February', 'March', 'April', 'May', 'June', 'July',
@@ -262,26 +269,33 @@
     return data['count']
 
 def report_needsponsor(bugs, bugdata, loader, tmpdir, subs):
+    # Note that this abuses the "month" view to group by reporter instead of month.
     data = deepcopy(subs)
     data['description'] = 'This page lists all new NEEDSPONSOR tickets (those without the fedora-revlew flag set)'
     data['title'] = 'NEEDSPONSOR tickets'
-    curmonth = ''
+    curreporter = ''
     curcount = 0
+    selected = []
 
     for i in bugs:
-         if select_needsponsor(i, bugdata[i.bug_id]):
-            rowclass = 'bz_row_even'
-            if data['count'] % 2 == 1:
-                rowclass = 'bz_row_odd'
-
-            if curmonth != yrmonth(i.opendate):
-                data['months'].append({'month': yrmonth(i.opendate), 'bugs': []})
-                curmonth = yrmonth(i.opendate)
-                curcount = 0
-
-            data['months'][-1]['bugs'].append(std_row(i, rowclass))
-            data['count'] +=1
-            curcount +=1
+        if select_needsponsor(i, bugdata[i.bug_id]):
+            selected.append(i)
+    selected.sort(key=reporter)
+
+    for i in selected:
+        rowclass = 'bz_row_even'
+        if data['count'] % 2 == 1:
+            rowclass = 'bz_row_odd'
+
+        if curreporter != reporter(i):
+            data['months'].append({'month': reporter(i), 'bugs': []})
+            curreporter = reporter(i)
+            curcount = 0
+
+        print i.bug_id, curreporter, reporter(i);
+        data['months'][-1]['bugs'].append(std_row(i, rowclass))
+        data['count'] +=1
+        curcount +=1
 
     write_html(loader, 'bymonth.html', data, tmpdir, 'NEEDSPONSOR.html')
 
@@ -289,7 +303,7 @@
 
 def report_new(bugs, bugdata, loader, tmpdir, subs):
     data = deepcopy(subs)
-    data['description'] = 'This page lists new, reviewable package review tickets (excluding merge reviews)'
+    data['description'] = 'This page lists new, reviewable package review tickets (excluding merge reviews).  Tickets colored green require a sponsor.'
     data['title'] = 'New package review tickets'
 
     curmonth = ''




More information about the fedora-extras-commits mailing list