Fix recheckwatch sorting.

It was reversed.

And subject to a theroretical zero-div bug, but unlikely due to
timing.

Change-Id: I1e9653889033cc77075a4c806535a71e2ef456d6
Reviewed-on: https://review.openstack.org/19959
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
This commit is contained in:
James E. Blair 2013-01-17 10:06:22 -08:00 committed by Jenkins
parent 3c3f14078b
commit 6e54fb05ab

View File

@ -123,12 +123,14 @@ class Scoreboard(threading.Thread):
def impact(bug):
"This ranks more recent bugs higher"
return (len(bug.hits) * (5.0 / ((bug.last_seen-now).days)))
age = (bug.last_seen-now).days
if not age:
age = -1
return (len(bug.hits) * (5.0 / age))
# Get the bugs reverse sorted by impact
bugs = self.scores.values()
bugs.sort(lambda a,b: cmp(impact(a), impact(b)))
bugs.reverse()
loader = TemplateLoader([self.template_dir], auto_reload=True)
tmpl = loader.load('scoreboard.html')
out = open(self.output_file, 'w')