[Blends-commit] [SCM] website branch, master, updated. 9d98dc30fa66151efb3cc1a76dbdc2fc952a5db6

Andreas Tille tille at debian.org
Fri Jul 26 17:15:55 UTC 2013


The following commit has been merged in the master branch:
commit 9d98dc30fa66151efb3cc1a76dbdc2fc952a5db6
Author: Andreas Tille <tille at debian.org>
Date:   Fri Jul 26 19:11:32 2013 +0200

    severitysummary somehow working

diff --git a/webtools/bugs_udd.py b/webtools/bugs_udd.py
index 0bc5c7d..95c1905 100755
--- a/webtools/bugs_udd.py
+++ b/webtools/bugs_udd.py
@@ -138,22 +138,26 @@ def main():
     VERYGOOD     =  10 # nothing burning
     EXCELLENT    =   5 # There is no real need to look at this meta package
 
+    severitysummary = {} # Number of bugs in different severity / dependency classes
+
     # initialise bugs_data dictionary for all tasks
     _execute_udd_query( "EXECUTE query_get_tasks('%s')" % blendname)
     bugs_data = {}
     if curs.rowcount > 0:
-        for task in curs.fetchall():
-            bugs_data[task[0]] = {}
-            bugs_data[task[0]]['nopenbugs'] = 0
-            bugs_data[task[0]]['ndonebugs'] = 0
-            bugs_data[task[0]]['weighttask'] = 0
+        for t in curs.fetchall():
+            task = t[0]
+            bugs_data[task] = {}
+            bugs_data[task]['nopenbugs'] = 0
+            bugs_data[task]['ndonebugs'] = 0
+            bugs_data[task]['weighttask'] = 0
             for status in STATES:
-                bugs_data[task[0]][status + '_l']  = [] # enable sorting
-                bugs_data[task[0]][status]         = {}
+                bugs_data[task][status + '_l']  = [] # enable sorting
+                bugs_data[task][status]         = {}
                 if status != 'done':
-                    bugs_data[task[0]][status]['severities'] = {}
+                    bugs_data[task][status]['severities'] = {}
                     for s in SEVERITIES:
-                        bugs_data[task[0]][status]['severities'][s] = 0
+                        bugs_data[task][status]['severities'][s] = 0
+            severitysummary[task] = {}
     else:
         print >>stderr, "No tasks metadata received for Blend", blendname
         exit(1)
@@ -335,11 +339,10 @@ the right shows the tasks of %s.""" ) \
     nbugs           = {}
     ndone           = {}
     buglist         = {}
-    severitysummary = {} # Number of bugs in different severity / dependency classes
     weightedsev     = {} # verbal interpretation of weighted bugs
     weightedclass   = {} # CSS class according bug weight
     weighttask      = {} # weighted severity as number per task
-    severitystat    = {} # Count bugs with different severities per task
+    # severitystat    = {} # Count bugs with different severities per task
     for task in (): ## FIXME:  bugs_data:
     	pkgbugs       = []
     	nbugs[task]   = 0
@@ -375,30 +378,17 @@ the right shows the tasks of %s.""" ) \
     		nbugs[task] += pkgbug_oad.open.nbugs
     		ndone[task] += pkgbug_oad.done.nbugs
     
-    	severitysummary[task] = {}
-    	wsev = 0  # sumarise weighted severities
-    	severitystat[task] = {}
-    	for cat in BUGLISTCAT:
-    		curbuglist = buglist[task][cat]
-    		if len(curbuglist.pkgbugs) > 0:
-    			# sort lists of PkgBug objects inside the three categories
-    			curbuglist.pkgbugs.sort()
-    		severitysummary[task][cat] = ''
-    		severitystat[task][cat] = {}
-    		if cat != DONE:
-    			sevsum = ''
-    			komma  = ''
-    			fac = 1
-    			if cat == DEPENDENT:
-    				fac = 3
-    			for s in SEVERITIES:
-    				if curbuglist.severities[s] > 0:
-    					sevsum += komma + str(curbuglist.severities[s]) + ' ' + s
-    					komma   = ', '
-    				severitystat[task][cat][s] = curbuglist.severities[s]
-    				# calculate weighted severity for whole metapackage
-    				wsev += fac * weight[s] * curbuglist.severities[s]
-    			severitysummary[task][cat] = sevsum
+    wsev = 0  # sumarise weighted severities
+    for task in bugs_data:
+    	for status in STATES:
+            if status != 'done':
+                severitysummary[task][status] = ''
+                komma  = ''
+                for s in SEVERITIES:
+    		     if bugs_data[task][status]['severities'][s] != 0:
+    		        severitysummary[task][status] += '%s %i %s' % (komma, bugs_data[task][status]['severities'][s], s)
+    		        komma = ','
+    	print "DEBUG", task, severitysummary[task]
     	if   wsev < data['assessments'][0][0]:
     		weightedsev[task]   = _('Metapackage is in excellent shape')
     		weightedclass[task] = data['assessments'][0][1]
@@ -432,6 +422,11 @@ the right shows the tasks of %s.""" ) \
                         'suggested' : 'bugssuggested',
                         'done'      : 'bugsdone'
                        }
+    # FIXME: just always use 'depends' or 'dependent' etc.  This translation is just to be able to compare with old output
+    data['category'] = {'depends'   : 'dependent',
+                        'suggests'  : 'suggested',
+                        'done'      : 'done'
+                       }
     
     data['nbugs']           = nbugs
     data['ndone']           = ndone
@@ -450,9 +445,9 @@ the right shows the tasks of %s.""" ) \
     
     for task in bugs_data:
     	data['task']            = task
-	print "DEBUG: export", task, bugs_data[task]['weightedsev']
     	#data['buglist']         = buglist[task]
-    	#data['severitysummary'] = severitysummary[task]
+        print "DEBUG: export", task, severitysummary[task]
+        data['severitysummary']  = severitysummary[task]
     	#data['weightedsev']     = weightedsev[task]
     	#data['severitystat']    = severitystat[task]
     
diff --git a/webtools/templates/bugs_udd.xhtml b/webtools/templates/bugs_udd.xhtml
index e3bf90f..4126ff1 100644
--- a/webtools/templates/bugs_udd.xhtml
+++ b/webtools/templates/bugs_udd.xhtml
@@ -87,9 +87,9 @@
     <py:for each="status in states">
       <span py:choose="">
 	<span py:when="bugs_data[task][status] != {}">
-	  <h2>${headings[status]}</h2>
-            <div class="severitylist" py:if="severitysummary[task][status] != ''">
-                ${severitysummary[task][status]}
+	  <h2>${headings[category[status]]}</h2>
+            <div class="severitylist" py:if="severitysummary[status] != ''">
+                ${severitysummary[status]}
 	    </div>
 	  <table class="${cssclass[cat]}">
 	    <py:for each="pkgbug in buglist[cat].pkgbugs">

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list