launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #08027
[Merge] lp:~dooferlad/launchpad/upcomingwork_show_incomplete_bp into lp:launchpad
James Tunnicliffe has proposed merging lp:~dooferlad/launchpad/upcomingwork_show_incomplete_bp into lp:launchpad.
Requested reviews:
Abel Deuring (adeuring)
James Tunnicliffe (dooferlad)
Related bugs:
Bug #999717 in Launchpad itself: "upcomingwork view blueprints should be initially expanded if incomplete"
https://bugs.launchpad.net/launchpad/+bug/999717
For more details, see:
https://code.launchpad.net/~dooferlad/launchpad/upcomingwork_show_incomplete_bp/+merge/106438
-- Summary --
Feature request: Lists of unfinished work items should default to expanded.
-- Proposed fix --
Add a property that is true if there is work left to do on a blueprint, which is used to add the expanded class to the tbody element that is expanded/collapsed to show/hide work items associated with the blueprint.
-- Pre-implementation notes --
None.
-- Implementation details --
Added a property that is true if there is work left to do on a blueprint, which is used to add the expanded class to the tbody element that is expanded/collapsed to show/hide work items associated with the blueprint.
-- LOC Rationale --
+24 lines but this will be more than offset by https://code.launchpad.net/~danilo/launchpad/kill-feedback-requests/+merge/106119
-- Tests --
bin/test -cvt test_has_incomplete_work
-- Demo and Q/A --
1. In a dev instance run http://paste.ubuntu.com/992291/ to generate some work
items
2. Visit https://launchpad.dev/~hwdb-team/+upcomingwork and see that all
blueprints are open (no tasks are complete).
3. Pick a blueprint from ^^ and complete all the work items. Return to ^^. The
blueprint with all work items completed should be collapsed.
-- Lint --
None.
--
https://code.launchpad.net/~dooferlad/launchpad/upcomingwork_show_incomplete_bp/+merge/106438
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py 2012-05-07 16:43:13 +0000
+++ lib/lp/registry/browser/person.py 2012-05-18 17:34:26 +0000
@@ -4520,6 +4520,11 @@
return '{0:.0f}'.format(
100.0 * len(self.done_items) / len(self._items))
+ @property
+ def has_incomplete_work(self):
+ """Return True if there are incomplete work items."""
+ return len(self.done_items) < len(self._items)
+
def append(self, item):
self._items.append(item)
=== modified file 'lib/lp/registry/browser/tests/test_person_upcomingwork.py'
--- lib/lp/registry/browser/tests/test_person_upcomingwork.py 2012-04-05 13:49:54 +0000
+++ lib/lp/registry/browser/tests/test_person_upcomingwork.py 2012-05-18 17:34:26 +0000
@@ -173,6 +173,16 @@
container.append(self.MockWorkItem(True))
self.assertEqual('67', container.percent_done)
+ def test_has_incomplete_work(self):
+ # If there are incomplete work items,
+ # WorkItemContainer.has_incomplete_work will return True.
+ container = WorkItemContainer()
+ item = self.MockWorkItem(False)
+ container.append(item)
+ self.assertTrue(container.has_incomplete_work)
+ item.is_complete = True
+ self.assertFalse(container.has_incomplete_work)
+
class TestPersonUpcomingWork(BrowserTestCase):
=== modified file 'lib/lp/registry/templates/person-upcomingwork.pt'
--- lib/lp/registry/templates/person-upcomingwork.pt 2012-04-05 13:45:31 +0000
+++ lib/lp/registry/templates/person-upcomingwork.pt 2012-05-18 17:34:26 +0000
@@ -108,7 +108,16 @@
</td>
</tr>
</tbody>
- <tbody class="collapsible-body">
+
+ <tal:conditional condition="container/has_incomplete_work">
+ <div tal:define="global classname string:expanded"/>
+ </tal:conditional>
+
+ <tal:conditional condition="not: container/has_incomplete_work">
+ <div tal:define="global classname string:"/>
+ </tal:conditional>
+
+ <tbody tal:attributes="class string:collapsible-body ${classname}">
<tr tal:repeat="workitem container/items" class="padded">
<td>
<span tal:condition="not: container/spec|nothing"
Follow ups