← Back to team overview

launchpad-reviewers team mailing list archive

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

 

James Tunnicliffe has proposed merging lp:~dooferlad/launchpad/postponed-is-done-wi-auto-open-fix into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1002946 in Launchpad itself: "Upcoming Work View auto-expand logic doesn't consider postponed = done"
  https://bugs.launchpad.net/launchpad/+bug/1002946

For more details, see:
https://code.launchpad.net/~dooferlad/launchpad/postponed-is-done-wi-auto-open-fix/+merge/106836

-- 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.
-- 
https://code.launchpad.net/~dooferlad/launchpad/postponed-is-done-wi-auto-open-fix/+merge/106836
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~dooferlad/launchpad/postponed-is-done-wi-auto-open-fix into lp:launchpad.
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2012-05-21 19:40:33 +0000
+++ lib/lp/registry/browser/person.py	2012-05-22 15:26:18 +0000
@@ -4539,7 +4539,8 @@
     @property
     def has_incomplete_work(self):
         """Return True if there are incomplete work items."""
-        return len(self.done_items) < len(self._items)
+        return (len(self.done_items) + len(self.postponed_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-05-22 03:42:34 +0000
+++ lib/lp/registry/browser/tests/test_person_upcomingwork.py	2012-05-22 15:26:18 +0000
@@ -187,6 +187,10 @@
         self.assertTrue(container.has_incomplete_work)
         item.is_complete = True
         self.assertFalse(container.has_incomplete_work)
+        item.status = SpecificationWorkItemStatus.POSTPONED
+        self.assertFalse(container.has_incomplete_work)
+        item.is_complete = False
+        self.assertFalse(container.has_incomplete_work)
 
 
 class TestPersonUpcomingWork(BrowserTestCase):


Follow ups