To make this even nicer you could add something like a
valid_states_with_labels to report_tools (by zip()ping a list containing
the lables with the existing valid_states there). :)
> </table>
> <%def name="workitems_per_day(workitems, days)">
> % if days < 1:
>
> === added file 'templates/workitem_list.html'
> --- templates/workitem_list.html 1970-01-01 00:00:00 +0000
> +++ templates/workitem_list.html 2011-02-26 01:01:57 +0000
> @@ -0,0 +1,29 @@
> +<%inherit file="base.html"/>
> +<%namespace name="base" file="base.html"/>
> +
> +<%def name="title()">
> +Work items in ${status} status
> +</%def>
> +
> +<h1>Work items in ${status} status</h1>
> +
> +<p>This page shows the full list of workitems in a particular status. This can be useful to see a list of workitems that are blocked or postponed for instance.</p>
> +
> +<table class="workitems_in_status">
> + <thead>
> + <tr>
> + <th>Blueprint</th>
> + <th>Priority</th>
> + <th>Assignee</th>
> + <th>Description</th>
> + </tr>
> + </thead>
> +% for workitem in workitems:
> + <tr>
> + <td><a href="{workitem.blueprint.url}">${workitem.blueprint.name}</a></td>
> + <td class="priority_${workitem.blueprint.priority}">${workitem.blueprint.priority}</td>
> + <td>${base.real_name(workitem.assignee)}</td>
> + <td>${workitem.description}</td>
> + </tr>
> +% endfor
> +</table>
>
Hi James,
I think this looks good but the new functions/methods would benefit from
some docstrings. I also have a few comments below.
review approve
On Sat, 2011-02-26 at 01:02 +0000, James Westby wrote: join(opts. output_ dir, "about") tools.about_ page(my_ path, opts.database, basename, opts.config, root=opts.root) tools.valid_ states: join(opts. output_ dir, status) tools.workitem_ list(my_ path, opts.database, basename, opts.config, status, root=opts.root) join(opts. output_ dir, 'index') tools.status_ overview( my_path, opts.database, basename, opts.config, root=opts.root) WorkitemTarget) : assignee completion( db, team, milestone): tools.spec_ group_completio n(db, team, milestone) in_status( db, status, team=None, milestone=None): tools.assignee_ completion( milestone) [status] : description, status, blueprint, tools.team_ information( db, team=team) dict(page_ type="about" )) tools.fill_ template( "about. html", data) in_status( opts.milestone) data(db, opts) dict(status= opts.status) ) dict(workitems= workitems) ) dict(page_ type="overview" ))
[...]
> === modified file 'generate-all'
> --- generate-all 2011-02-06 20:00:12 +0000
> +++ generate-all 2011-02-26 01:01:57 +0000
> @@ -133,6 +133,11 @@
> basename = os.path.
> report_
>
> +# workitems in status pages
> +for status in report_
> + basename = os.path.
> + report_
> +
> # front page
> basename = os.path.
> report_
>
> === modified file 'html-report'
> --- html-report 2011-02-25 02:56:48 +0000
> +++ html-report 2011-02-26 01:01:57 +0000
> @@ -47,6 +47,7 @@
> self.priority = priority
> self.status = status
>
> +
> class Assignee(
>
> def __init__(self, name, url, complexity=0, todo_wis=[],
> @@ -90,6 +91,19 @@
> return any([g.priority for g in self.groups])
>
>
> +class Workitem(object):
> +
> + def __init__(self, description, status, blueprint, assignee=None):
> + self.description = description
> + self.status = status
> + self.blueprint = blueprint
> + self._assignee = assignee
> +
> + @property
> + def assignee(self):
> + return self._assignee or self.blueprint.
> +
> +
> def spec_group_
> data = report_
> if not data:
> @@ -286,6 +300,21 @@
> return group
>
>
> +def workitems_
> + data = report_
> + db, team=team, milestone=
> + workitems = []
> + for assignee in data:
> + if status in data[assignee]:
> + for wi_info in data[assignee]
> + bp_name, description, priority, url = wi_info
> + blueprint = Blueprint(bp_name, url, priority=priority)
> + workitems.append(
> + Workitem(
> + assignee=assignee))
> + return workitems
> +
> +
> def list_people(db, team=None):
> team_info = report_
> if team is None:
> @@ -398,6 +427,17 @@
> data.update(
> print report_
>
> + def workitem_list(self, db, opts):
> + assert opts.status is not None, (
> + "Must pass --status for workitem_list report-type")
> + workitems = workitems_
> + db, opts.status, team=opts.team, milestone=
> + data = self.template_
> + data.update(
> + data.update(
> + data.update(
Why 3 update() calls instead of just one passing a dict combining
everything?
> + print report_ tools.fill_ template( "workitem_ list.html" , data) add_option( '--root' , dest="root", add_option( '--status' , dest="status", parse_args( ) list(my_ path, database, basename, config, status, root=None): "primary_ team", None) basename( basename) join(my_ path, 'html-report'), '-d', database, '--chart', '%s.svg' % chartname] page(my_ path, database, basename, config, root=None): "primary_ team", None) base.html' Essential, th.priority_ Essential { color: red; } tion_status { font-size: 70%; } in_status" ).tablesorter( { [0,0],[ 2,0]],
> +
>
> #
> # main
> @@ -426,6 +466,8 @@
> help="Select the group for a group_overview report.")
> optparser.
> help="Root URL for the charts")
> + optparser.
> + help="Workitem status to consider for workitem_list report-type")
>
> (opts, args) = optparser.
> if not opts.database:
>
> === modified file 'report_tools.py'
> --- report_tools.py 2011-02-24 01:33:40 +0000
> +++ report_tools.py 2011-02-26 01:01:57 +0000
> @@ -76,6 +76,25 @@
> proc.wait()
>
>
> +def workitem_
> + cfg = load_config(config)
> + team = cfg.get(
> + fh = open(basename + '.html', 'w')
> + chartname = os.path.
> + try:
> + args = [os.path.
> + args += ['--report-type', 'group_overview']
> + args += ['--status', status]
> + if root:
> + args += ['--root', root]
> + report_args(args, team=team)
> + proc = Popen(args, stdout=fh)
> + print basename + '.html'
> + proc.wait()
> + finally:
> + fh.close()
> +
> +
> def team_list_
> cfg = load_config(config)
> team = cfg.get(
>
> === modified file 'templates/
> --- templates/base.html 2011-02-25 23:03:45 +0000
> +++ templates/base.html 2011-02-26 01:01:57 +0000
> @@ -19,11 +19,11 @@
> td.priority_
> td span.implementa
>
> - .status-todo {color: orange;}
> - .status-inprogress {color: gray;}
> - .status-done {color: green;}
> - .status-blocked {color: red;}
> - .status-postponed {color: purple;}
> + .status-todo a {color: orange;}
> + .status-inprogress a {color: gray;}
> + .status-done a {color: green;}
> + .status-blocked a {color: red;}
> + .status-postponed a {color: purple;}
>
> .interesting {
> font-weight: bold;
> @@ -340,6 +340,13 @@
> }
> });
>
> + $(".workitems_
> + sortList: [[1,1],
Maybe a comment explaining these magic numbers?
> + headers: { m").tablesorter (); overview. html' overview. html 2011-02-16 21:53:06 +0000 overview. html 2011-02-26 01:01:57 +0000 status- todo"> workitems. todo}</ td> status- blocked" > workitems. blocked} </td> status- inprogress" > workitems. inprogress} </td> status- done"> workitems. done}</ td> status- postponed" > workitems. postponed} </td> status- ${status} "> {base.url( status + '.html' )}">${label} </a></td> {base.url( status + '.html' )}">${getattr( all_workitems, status) }</a></ td>
> + 1: { sorter:'priority' }
> + }
> + });
> +
> // with the 'todo/done' and assignee not appearing on every
> // row, this does not lend itself well to sorting
> //$("#byworkite
>
> === modified file 'templates/
> --- templates/
> +++ templates/
> @@ -44,26 +44,12 @@
> <th>Count</th>
> </tr>
> </thead>
> -<tr class="
> - <td>Todo</td>
> - <td>${all_
> -</tr>
> -<tr class="
> - <td>Blocked</td>
> - <td>${all_
> -</tr>
> -<tr class="
> - <td>In Progress</td>
> - <td>${all_
> -</tr>
> -<tr class="
> - <td>Done</td>
> - <td>${all_
> -</tr>
> -<tr class="
> - <td>Postponed</td>
> - <td>${all_
> -</tr>
> +% for status, label in [('todo', 'Todo'), ('blocked', 'Blocked'), ('inprogress', 'In Progress'), ('done', 'Done'), ('postponed', 'Postponed')]:
> +<tr class="
> + <td><a href="$
> + <td><a href="$
> +</tr>
> +% endfor
To make this even nicer you could add something like a with_labels to report_tools (by zip()ping a list containing
valid_states_
the lables with the existing valid_states there). :)
> </table> _per_day( workitems, days)"> workitem_ list.html' workitem_ list.html 1970-01-01 00:00:00 +0000 workitem_ list.html 2011-02-26 01:01:57 +0000 workitems_ in_status" > </th> workitem. blueprint. url}">$ {workitem. blueprint. name}</ a></td> priority_ ${workitem. blueprint. priority} ">${workitem. blueprint. priority} </td> real_name( workitem. assignee) }</td> description} </td>
> <%def name="workitems
> % if days < 1:
>
> === added file 'templates/
> --- templates/
> +++ templates/
> @@ -0,0 +1,29 @@
> +<%inherit file="base.html"/>
> +<%namespace name="base" file="base.html"/>
> +
> +<%def name="title()">
> +Work items in ${status} status
> +</%def>
> +
> +<h1>Work items in ${status} status</h1>
> +
> +<p>This page shows the full list of workitems in a particular status. This can be useful to see a list of workitems that are blocked or postponed for instance.</p>
> +
> +<table class="
> + <thead>
> + <tr>
> + <th>Blueprint</th>
> + <th>Priority</th>
> + <th>Assignee</th>
> + <th>Description
> + </tr>
> + </thead>
> +% for workitem in workitems:
> + <tr>
> + <td><a href="{
> + <td class="
> + <td>${base.
> + <td>${workitem.
> + </tr>
> +% endfor
> +</table>
>
-- /launchpad. net/~salgado>
Guilherme Salgado <https:/