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
1=== modified file 'lib/lp/registry/model/person.py'
2--- lib/lp/registry/model/person.py 2012-05-11 14:12:49 +0000
3+++ lib/lp/registry/model/person.py 2012-05-14 11:23:19 +0000
4@@ -1501,6 +1501,7 @@
5 today = datetime.today().date()
6 query = AND(
7 Milestone.dateexpected <= date, Milestone.dateexpected >= today,
8+ WorkItem.deleted == False,
9 OR(WorkItem.assignee_id.is_in(self.participant_ids),
10 Specification.assigneeID.is_in(self.participant_ids)))
11 result = store.using(*origin).find(WorkItem, query)
12@@ -2987,7 +2988,8 @@
13 owner=self, purpose=ArchivePurpose.PPA,
14 distribution=ubuntu, name=name, displayname=displayname,
15 description=description, private=private,
16- suppress_subscription_notifications=suppress_subscription_notifications)
17+ suppress_subscription_notifications=(
18+ suppress_subscription_notifications))
19
20 def isBugContributor(self, user=None):
21 """See `IPerson`."""
22
23=== modified file 'lib/lp/registry/tests/test_person.py'
24--- lib/lp/registry/tests/test_person.py 2012-05-11 14:12:49 +0000
25+++ lib/lp/registry/tests/test_person.py 2012-05-14 11:23:19 +0000
26@@ -1155,6 +1155,18 @@
27
28 self.assertEqual([workitem], list(workitems))
29
30+ def test_skips_deleted_workitems(self):
31+ assigned_spec = self.factory.makeSpecification(
32+ assignee=self.team.teamowner, milestone=self.current_milestone,
33+ product=self.product)
34+ # Create a deleted work item.
35+ self.factory.makeSpecificationWorkItem(
36+ title=u'workitem', specification=assigned_spec, deleted=True)
37+
38+ workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
39+ self.current_milestone.dateexpected)
40+ self.assertEqual([], list(workitems))
41+
42 def test_workitems_assigned_to_others_working_on_blueprint(self):
43 assigned_spec = self.factory.makeSpecification(
44 assignee=self.team.teamowner, milestone=self.current_milestone,