Merge lp:~dooferlad/launchpad/postponed-is-done-wi-auto-open-fix into lp:launchpad

Proposed by James Tunnicliffe on 2012-05-22
Status: Merged
Approved by: Graham Binns on 2012-05-22
Approved revision: no longer in the source branch.
Merged at revision: 15285
Proposed branch: lp:~dooferlad/launchpad/postponed-is-done-wi-auto-open-fix
Merge into: lp:launchpad
Diff against target: 28 lines (+6/-1)
2 files modified
lib/lp/registry/browser/person.py (+2/-1)
lib/lp/registry/browser/tests/test_person_upcomingwork.py (+4/-0)
To merge this branch: bzr merge lp:~dooferlad/launchpad/postponed-is-done-wi-auto-open-fix
Reviewer Review Type Date Requested Status
Graham Binns (community) code 2012-05-22 Approve on 2012-05-22
Review via email: mp+106836@code.launchpad.net

Commit Message

Work item lists on the upcoming work page auto-expand if there are work items that need further work. For that logic, count POSTPONED as complete.

Description of the Change

-- Summary
Bug Fix: Two recent changes to the upcoming work view didn’t quite mesh. One changed how we calculate % of work complete for a blueprint (done + postponed Vs everything else) and the other auto-expanded all work item lists that had unfinished work associated with them. The function that returns if there was any unfinished work for a blueprint did not get updated.

-- Proposed fix
Modify WorkItemContainer.has_incomplete_work to consider postponed work items as done.

-- Pre-implementation notes
None.

-- Implementation details
Modified WorkItemContainer.has_incomplete_work to consider postponed work items as done. Updated tests.

-- LOC Rationale
Added a few lines because of new functionality. These will be more than offset by:
https://code.launchpad.net/~danilo/launchpad/kill-feedback-requests/+merge/106119

-- Tests
bin/test -cvt test_person_upcomingwork

-- 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 pick a blueprint. Set set all items as DONE. The upcoming work view should collapse the work item list for that blueprint. Modifiy some work items to be POSTPONED. Upcoming work view should still have the work item list collapsed.

-- Lint
None.

To post a comment you must log in.
Graham Binns (gmb) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/person.py'
2--- lib/lp/registry/browser/person.py 2012-05-21 19:40:33 +0000
3+++ lib/lp/registry/browser/person.py 2012-05-22 15:26:18 +0000
4@@ -4539,7 +4539,8 @@
5 @property
6 def has_incomplete_work(self):
7 """Return True if there are incomplete work items."""
8- return len(self.done_items) < len(self._items)
9+ return (len(self.done_items) + len(self.postponed_items) <
10+ len(self._items))
11
12 def append(self, item):
13 self._items.append(item)
14
15=== modified file 'lib/lp/registry/browser/tests/test_person_upcomingwork.py'
16--- lib/lp/registry/browser/tests/test_person_upcomingwork.py 2012-05-22 03:42:34 +0000
17+++ lib/lp/registry/browser/tests/test_person_upcomingwork.py 2012-05-22 15:26:18 +0000
18@@ -187,6 +187,10 @@
19 self.assertTrue(container.has_incomplete_work)
20 item.is_complete = True
21 self.assertFalse(container.has_incomplete_work)
22+ item.status = SpecificationWorkItemStatus.POSTPONED
23+ self.assertFalse(container.has_incomplete_work)
24+ item.is_complete = False
25+ self.assertFalse(container.has_incomplete_work)
26
27
28 class TestPersonUpcomingWork(BrowserTestCase):