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

Proposed by Данило Шеган
Status: Merged
Approved by: William Grant
Approved revision: no longer in the source branch.
Merged at revision: 15248
Proposed branch: lp:~danilo/launchpad/bug-999040
Merge into: lp:launchpad
Diff against target: 44 lines (+15/-1)
2 files modified
lib/lp/registry/model/person.py (+3/-1)
lib/lp/registry/tests/test_person.py (+12/-0)
To merge this branch: bzr merge lp:~danilo/launchpad/bug-999040
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+105637@code.launchpad.net

Commit message

Do not show removed work items on person/team's upcoming work pages.

Description of the change

= 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

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

This probably needs a followup to offset the LOC addition, but otherwise looks reasonable.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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:23:19 +0000
@@ -1501,6 +1501,7 @@
1501 today = datetime.today().date()1501 today = datetime.today().date()
1502 query = AND(1502 query = AND(
1503 Milestone.dateexpected <= date, Milestone.dateexpected >= today,1503 Milestone.dateexpected <= date, Milestone.dateexpected >= today,
1504 WorkItem.deleted == False,
1504 OR(WorkItem.assignee_id.is_in(self.participant_ids),1505 OR(WorkItem.assignee_id.is_in(self.participant_ids),
1505 Specification.assigneeID.is_in(self.participant_ids)))1506 Specification.assigneeID.is_in(self.participant_ids)))
1506 result = store.using(*origin).find(WorkItem, query)1507 result = store.using(*origin).find(WorkItem, query)
@@ -2987,7 +2988,8 @@
2987 owner=self, purpose=ArchivePurpose.PPA,2988 owner=self, purpose=ArchivePurpose.PPA,
2988 distribution=ubuntu, name=name, displayname=displayname,2989 distribution=ubuntu, name=name, displayname=displayname,
2989 description=description, private=private,2990 description=description, private=private,
2990 suppress_subscription_notifications=suppress_subscription_notifications)2991 suppress_subscription_notifications=(
2992 suppress_subscription_notifications))
29912993
2992 def isBugContributor(self, user=None):2994 def isBugContributor(self, user=None):
2993 """See `IPerson`."""2995 """See `IPerson`."""
29942996
=== 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:23:19 +0000
@@ -1155,6 +1155,18 @@
11551155
1156 self.assertEqual([workitem], list(workitems))1156 self.assertEqual([workitem], list(workitems))
11571157
1158 def test_skips_deleted_workitems(self):
1159 assigned_spec = self.factory.makeSpecification(
1160 assignee=self.team.teamowner, milestone=self.current_milestone,
1161 product=self.product)
1162 # Create a deleted work item.
1163 self.factory.makeSpecificationWorkItem(
1164 title=u'workitem', specification=assigned_spec, deleted=True)
1165
1166 workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
1167 self.current_milestone.dateexpected)
1168 self.assertEqual([], list(workitems))
1169
1158 def test_workitems_assigned_to_others_working_on_blueprint(self):1170 def test_workitems_assigned_to_others_working_on_blueprint(self):
1159 assigned_spec = self.factory.makeSpecification(1171 assigned_spec = self.factory.makeSpecification(
1160 assignee=self.team.teamowner, milestone=self.current_milestone,1172 assignee=self.team.teamowner, milestone=self.current_milestone,