[Cdd-commits] r1187 - in cdd/trunk/webtools: . templates

CDD Subversion Commit noreply at alioth.debian.org
Sat Nov 1 17:37:56 UTC 2008


Author: tille
Date: Sat Nov  1 17:37:55 2008
New Revision: 1187

Modified:
   cdd/trunk/webtools/bugs.py
   cdd/trunk/webtools/templates/bugs.xhtml
Log:
Evaluation of general severity of dependencies of metapackages


Modified: cdd/trunk/webtools/bugs.py
==============================================================================
--- cdd/trunk/webtools/bugs.py	(original)
+++ cdd/trunk/webtools/bugs.py	Sat Nov  1 17:37:55 2008
@@ -190,9 +190,11 @@
 else:
 	data['projectadvertising'] = None
 
-nbugs   = {}
-ndone   = {}
-buglist = {}
+nbugs           = {}
+ndone           = {}
+buglist         = {}
+severitysummary = {}
+weightedsev     = {}
 for task in packages.keys():
 	pkgbugs       = []
 	nbugs[task]   = 0
@@ -220,10 +222,39 @@
 		nbugs[task] += pkgbug_oad.open.nbugs
 		ndone[task] += pkgbug_oad.done.nbugs
 
+	severitysummary[task] = {}
+	wsev = 0  # sumarise weighted severities
 	for cat in BUGLISTCAT:
-		if len(buglist[task][cat].pkgbugs) > 0:
+		curbuglist = buglist[task][cat]
+		if len(curbuglist.pkgbugs) > 0:
 			# sort lists of PkgBug objects inside the three categories
-			buglist[task][cat].pkgbugs.sort()
+			curbuglist.pkgbugs.sort()
+		severitysummary[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   = ', '
+				# calculate weighted severity for whole metapackage
+				wsev += fac * weight[s] * curbuglist.severities[s]
+			severitysummary[task][cat] = sevsum
+	if wsev < EXCELLENT:
+		weightedsev[task] = _('Metapackage is in excellent shape')
+	elif wsev < VERYGOOD:
+		weightedsev[task] = _('Metapackage is in very good shape')
+	elif wsev < GOOD:
+		weightedsev[task] = _('Metapackage is in good shape')
+	elif wsev < SATISFACTORY:
+		weightedsev[task] = _('Cosider looking into bugs of this metapackage')
+	elif wsev < PASS:
+		weightedsev[task] = _('Looking into bugs of this metapackage is recommended')
+	else:
+		weightedsev[task] = _('Immediately looking into bugs of the dependencies of this metapackage is advised')
 
 data['headings'] = {DEPENDENT : 'Open bugs in dependent packages',
                     SUGGESTED : 'Open bugs in suggested packages',
@@ -235,11 +266,13 @@
                    }
 
 for task in packages.keys():
-	data['task']       = task
-	data['nbugs']      = nbugs
-	data['ndone']      = ndone
-	data['buglist']    = buglist[task]
-	data['buglistcat'] = BUGLISTCAT
+	data['task']            = task
+	data['nbugs']           = nbugs
+	data['ndone']           = ndone
+	data['buglist']         = buglist[task]
+	data['buglistcat']      = BUGLISTCAT
+	data['severitysummary'] = severitysummary[task]
+	data['weightedsev']     = weightedsev[task]
 
 	template = loader.load('bugs.xhtml')
 	f = open(outputdir + '/' + task + '.html', 'w')

Modified: cdd/trunk/webtools/templates/bugs.xhtml
==============================================================================
--- cdd/trunk/webtools/templates/bugs.xhtml	(original)
+++ cdd/trunk/webtools/templates/bugs.xhtml	Sat Nov  1 17:37:55 2008
@@ -63,12 +63,17 @@
 
 <h1>Summary bugs page of ${tasks[task].metapkg.PrintedName.capitalize()} meta package</h1>
 
+<div class="severitysummary">${weightedsev}</div>
+
 <span py:choose="">
   <span py:when="nbugs[task]+ndone[task] != 0">
     <py:for each="cat in buglistcat">
       <span py:choose="">
 	<span py:when="buglist[cat].pkgbugs != []">
 	  <h2>${headings[cat]}</h2>
+            <span py:if="severitysummary[cat] != ''">
+                ${severitysummary[cat]}
+	    </span>
 	  <table class="${cssclass[cat]}">
 	    <py:for each="pkgbug in buglist[cat].pkgbugs">
 	      <span py:if="pkgbug.nbugs > 0">



More information about the Cdd-commits mailing list