← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~danilo/launchpad/bug-999040 into lp:launchpad

 

Данило Шеган has proposed merging lp:~danilo/launchpad/bug-999040 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #999040 in Launchpad itself: "+upcomingwork view shows removed work items"
  https://bugs.launchpad.net/launchpad/+bug/999040

For more details, see:
https://code.launchpad.net/~danilo/launchpad/bug-999040/+merge/105637

= Bug 999040: deleted work items show up in upcoming work views =

== Proposed fix ==

Do not include deleted work items in returned values from

  IPerson.getAssignedSpecificationWorkItemsDueBefore()

== Pre-implementation notes ==

None.

== LOC Rationale ==

This is a 1-line bug fix with the test.

Prior to work being started on workitems, several thousands of lines of code have been removed by Salgado.

== Implementation details ==

Add 'WorkItem.deleted == False' to the SQL query.

A single lint fix as well.

== Tests ==

bin/test -cvvt test_skips_deleted_workitems

== Demo and Q/A ==

Eg. on qastaging:

 1. Create a BP and assign it to yourself (this means all workitems will be assigned to you by default)
 2. Target that BP to a milestone with the target date set and in the future (or it won't be "upcoming work")
 3. Create two workitems in it, save.
 4. Remove one workitem.
 5. Go to https://qastaging.launchpad.net/people/me/+upcomingwork

Only the non-deleted work item should show up.

Note that feature flag needs to be set as well (though, it's already set for us).


= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/model/person.py
  lib/lp/registry/tests/test_person.py
-- 
https://code.launchpad.net/~danilo/launchpad/bug-999040/+merge/105637
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~danilo/launchpad/bug-999040 into lp:launchpad.
=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py	2012-05-11 14:12:49 +0000
+++ lib/lp/registry/model/person.py	2012-05-14 11:21:20 +0000
@@ -1501,6 +1501,7 @@
         today = datetime.today().date()
         query = AND(
             Milestone.dateexpected <= date, Milestone.dateexpected >= today,
+            WorkItem.deleted == False,
             OR(WorkItem.assignee_id.is_in(self.participant_ids),
                Specification.assigneeID.is_in(self.participant_ids)))
         result = store.using(*origin).find(WorkItem, query)
@@ -2987,7 +2988,8 @@
             owner=self, purpose=ArchivePurpose.PPA,
             distribution=ubuntu, name=name, displayname=displayname,
             description=description, private=private,
-            suppress_subscription_notifications=suppress_subscription_notifications)
+            suppress_subscription_notifications=(
+                suppress_subscription_notifications))
 
     def isBugContributor(self, user=None):
         """See `IPerson`."""

=== modified file 'lib/lp/registry/tests/test_person.py'
--- lib/lp/registry/tests/test_person.py	2012-05-11 14:12:49 +0000
+++ lib/lp/registry/tests/test_person.py	2012-05-14 11:21:20 +0000
@@ -1155,6 +1155,18 @@
 
         self.assertEqual([workitem], list(workitems))
 
+    def test_skips_deleted_workitems(self):
+        assigned_spec = self.factory.makeSpecification(
+            assignee=self.team.teamowner, milestone=self.current_milestone,
+            product=self.product)
+        # Create a deleted work item.
+        self.factory.makeSpecificationWorkItem(
+            title=u'workitem', specification=assigned_spec, deleted=True)
+
+        workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
+            self.current_milestone.dateexpected)
+        self.assertEqual([], list(workitems))
+
     def test_workitems_assigned_to_others_working_on_blueprint(self):
         assigned_spec = self.factory.makeSpecification(
                 assignee=self.team.teamowner, milestone=self.current_milestone,


Follow ups