Merge lp:~dooferlad/launchpad/upcoming_view_show_all_work_items into lp:launchpad

Proposed by James Tunnicliffe on 2012-05-11
Status: Merged
Approved by: Curtis Hovey on 2012-05-11
Approved revision: no longer in the source branch.
Merged at revision: 15239
Proposed branch: lp:~dooferlad/launchpad/upcoming_view_show_all_work_items
Merge into: lp:launchpad
Diff against target: 66 lines (+24/-10)
2 files modified
lib/lp/registry/model/person.py (+1/-2)
lib/lp/registry/tests/test_person.py (+23/-8)
To merge this branch: bzr merge lp:~dooferlad/launchpad/upcoming_view_show_all_work_items
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code 2012-05-11 Approve on 2012-05-11
Review via email: mp+105495@code.launchpad.net

Commit Message

Show all WIs owned by members of the team and all WIs from BPs assigned to members of the team (even if WI owner is not in the team)

Description of the Change

Summary
Bug fix: Show all WIs owned by members of the team and all WIs from BPs assigned to members of the team (even if WI owner is not in the team)

Proposed fix
Slightly modified DB query to get the correct list of work items.

Pre-implementation notes
None

Implementation details
Slightly modified DB query to get the correct list of work items.

LOC Rationale
1 line reduction in live code. Added 1 test. This results in a net increase, but tests the change.

Tests
bin/test -cvt test_workitems_assigned_to_others_working_on_blueprint

Demo and Q/A
https://launchpad.net/~linaro-infrastructure/+upcomingwork shows a list of blueprints. The one entitled "Setup Freescale Click Through" has one work item listed. If you look at the blueprint https://blueprints.launchpad.net/linaro-android/+spec/setup-freescale-click-through you can see work item assigned to other people.

Lint
= 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

./lib/lp/registry/model/person.py
    2990: E501 line too long (84 characters)

Above error is not part of my change.

To post a comment you must log in.
Curtis Hovey (sinzui) wrote :

Thank you.

I will land this.

review: Approve (code)
Robert Collins (lifeless) wrote :

For clarity, test code is considered as part of the LOC debt - they
are not separable, so this reason for LOC increase isn't sufficient.
An existing test may be too fat and refactorable, or other overhead
found, to balance things up.

-> a cleanup branch is needed after this one to compensate for the LOC increase.

Curtis Hovey (sinzui) wrote :

Hi James.

The instructions for QA are not represented on QAStaging. I tried to reproduce the setup described, but I failed. You need to verify this works on QAStaging.

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-04 12:02:44 +0000
3+++ lib/lp/registry/model/person.py 2012-05-11 14:49:18 +0000
4@@ -1502,8 +1502,7 @@
5 query = AND(
6 Milestone.dateexpected <= date, Milestone.dateexpected >= today,
7 OR(WorkItem.assignee_id.is_in(self.participant_ids),
8- AND(WorkItem.assignee == None,
9- Specification.assigneeID.is_in(self.participant_ids))))
10+ Specification.assigneeID.is_in(self.participant_ids)))
11 result = store.using(*origin).find(WorkItem, query)
12
13 def eager_load(workitems):
14
15=== modified file 'lib/lp/registry/tests/test_person.py'
16--- lib/lp/registry/tests/test_person.py 2012-05-02 05:25:11 +0000
17+++ lib/lp/registry/tests/test_person.py 2012-05-11 14:49:18 +0000
18@@ -1143,18 +1143,11 @@
19 workitem = self.factory.makeSpecificationWorkItem(
20 title=u'workitem 1', specification=assigned_spec)
21
22- # Create a workitem with somebody who's not a member of our team as
23- # the assignee. This workitem must not be in the list returned by
24- # getAssignedSpecificationWorkItemsDueBefore().
25- self.factory.makeSpecificationWorkItem(
26- title=u'workitem 2', specification=assigned_spec,
27- assignee=self.factory.makePerson())
28-
29 # Create a workitem targeted to a milestone too far in the future.
30 # This workitem must not be in the list returned by
31 # getAssignedSpecificationWorkItemsDueBefore().
32 self.factory.makeSpecificationWorkItem(
33- title=u'workitem 3', specification=assigned_spec,
34+ title=u'workitem 2', specification=assigned_spec,
35 milestone=self.future_milestone)
36
37 workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
38@@ -1162,6 +1155,28 @@
39
40 self.assertEqual([workitem], 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,
45+ product=self.product)
46+ # Create a workitem with no explicit assignee/milestone. This way it
47+ # will inherit the ones from the spec it belongs to.
48+ workitem = self.factory.makeSpecificationWorkItem(
49+ title=u'workitem 1', specification=assigned_spec)
50+
51+ # Create a workitem with somebody who's not a member of our team as
52+ # the assignee. This workitem must be in the list returned by
53+ # getAssignedSpecificationWorkItemsDueBefore().
54+ workitem_for_other_person = self.factory.makeSpecificationWorkItem(
55+ title=u'workitem 2', specification=assigned_spec,
56+ assignee=self.factory.makePerson())
57+
58+ workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
59+ self.current_milestone.dateexpected)
60+
61+ self.assertContentEqual([workitem, workitem_for_other_person],
62+ list(workitems))
63+
64 def test_skips_workitems_with_milestone_in_the_past(self):
65 today = datetime.today().date()
66 milestone = self.factory.makeMilestone(