From c1b4847821323a45810815f9e1ac9a556ac42408 Mon Sep 17 00:00:00 2001 From: "martin@piware.de" <> Date: Tue, 24 Nov 2009 17:34:35 +0100 Subject: [PATCH] workitems: add by-assignee report to HTML output --- workitems.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/workitems.py b/workitems.py index db89f51..7b22e60 100755 --- a/workitems.py +++ b/workitems.py @@ -308,6 +308,30 @@ def blueprint_completion(db): return data +def assignee_completion(db): + '''Determine current by-assignee completion. + + Return assignee -> [todo, done, postponed] mapping. + ''' + data = {} + + # last date + cur = db.cursor() + cur.execute('SELECT max(date) FROM work_items') + (last_date,) = cur.fetchone() + + index = 0 + for s in valid_states: + cur = db.cursor() + cur.execute('SELECT assignee, count(workitem) FROM work_items ' + 'WHERE date=? and status=? GROUP BY assignee', + (last_date, s)) + for (a, num) in cur: + data.setdefault(a, [0, 0, 0])[index] = num + index += 1 + + return data + def text(db): '''Print work item completion as text.''' @@ -406,6 +430,27 @@ def html(db): print '' + print ''' +

Status by assignee

+ + +''' + data = assignee_completion(db) + + completion = [] + for (a, (todo, done, postponed)) in data.iteritems(): + completion.append((a, + int(float(postponed+done)/(todo+done+postponed)*100 + 0.5))) + + completion.sort(key=lambda k: k[0], reverse=False) + + for (a, percent) in completion: + url = '%s/~%s/+specs?role=assignee' % (blueprints_base_url, a) + print ' ' % ( + url, a, data[a][0], data[a][2], + data[a][1], percent) + print '
Assignee todo/postponed/done Completion
%s %i/%i/%i %i%%
' + print '' def import_moin(db, urls): -- 2.39.2