Merge lp:~thumper/launchpad/fix-branch-active-reviews into lp:launchpad

Proposed by Tim Penhey on 2010-01-18
Status: Merged
Approved by: Michael Hudson-Doyle on 2010-01-18
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~thumper/launchpad/fix-branch-active-reviews
Merge into: lp:launchpad
Diff against target: 42 lines (+11/-2)
2 files modified
lib/lp/code/browser/branchmergeproposallisting.py (+3/-1)
lib/lp/code/browser/tests/test_branchmergeproposallisting.py (+8/-1)
To merge this branch: bzr merge lp:~thumper/launchpad/fix-branch-active-reviews
Reviewer Review Type Date Requested Status
Stuart Bishop Approve on 2010-01-18
Michael Hudson-Doyle 2010-01-18 Approve on 2010-01-18
Review via email: mp+17574@code.launchpad.net

Commit Message

Defer to date_created for work in progress merge proposals on the branch active reviews page.

To post a comment you must log in.
Tim Penhey (thumper) wrote :

https://code.edge.launchpad.net/~bzr-pqm/bzr/bzr.dev/+activereviews oopses due to a work in progress proposal. The code that decides on the date to sort by didn't used to take into account branches that were neither in review, nor reviewed.

tests:
  TestBranchMergeProposalListingItem

Michael Hudson-Doyle (mwhudson) wrote :

Aside from the "probress" typo, it looks good.

review: Approve
Stuart Bishop (stub) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/branchmergeproposallisting.py'
2--- lib/lp/code/browser/branchmergeproposallisting.py 2010-01-14 23:19:13 +0000
3+++ lib/lp/code/browser/branchmergeproposallisting.py 2010-01-18 09:43:16 +0000
4@@ -112,8 +112,10 @@
5 """
6 if self.context.date_review_requested is not None:
7 return self.context.date_review_requested
8- else:
9+ elif self.context.date_reviewed is not None:
10 return self.context.date_reviewed
11+ else:
12+ return self.context.date_created
13
14
15 class BranchMergeProposalListingBatchNavigator(TableBatchNavigator):
16
17=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposallisting.py'
18--- lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2010-01-14 23:39:06 +0000
19+++ lib/lp/code/browser/tests/test_branchmergeproposallisting.py 2010-01-18 09:43:16 +0000
20@@ -10,7 +10,6 @@
21
22 import pytz
23 import transaction
24-from zope.publisher.interfaces import NotFound
25 from zope.security.proxy import removeSecurityProxy
26
27 from canonical.launchpad.webapp.servers import LaunchpadTestRequest
28@@ -298,6 +297,14 @@
29 item = BranchMergeProposalListingItem(bmp, None, None)
30 self.assertEqual(review_date, item.sort_key)
31
32+ def test_sort_key_wip(self):
33+ # If the proposal is a work in progress, the date_created is used.
34+ bmp = self.factory.makeBranchMergeProposal(
35+ date_created=datetime(2009,6,1,tzinfo=pytz.UTC))
36+ login_person(bmp.target_branch.owner)
37+ item = BranchMergeProposalListingItem(bmp, None, None)
38+ self.assertEqual(bmp.date_created, item.sort_key)
39+
40
41 class ActiveReviewSortingTest(TestCaseWithFactory):
42 """Test the sorting of the active review groups."""