Merge lp:~intellectronica/launchpad/backout-hot-bugs-sort into lp:launchpad/db-devel

Proposed by Eleanor Berger on 2010-01-26
Status: Merged
Merged at revision: not available
Proposed branch: lp:~intellectronica/launchpad/backout-hot-bugs-sort
Merge into: lp:launchpad/db-devel
Diff against target: 186 lines (+30/-72)
4 files modified
lib/lp/bugs/browser/bugtarget.py (+0/-21)
lib/lp/bugs/browser/bugtask.py (+9/-0)
lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt (+18/-48)
lib/lp/bugs/templates/bugtarget-bugs.pt (+3/-3)
To merge this branch: bzr merge lp:~intellectronica/launchpad/backout-hot-bugs-sort
Reviewer Review Type Date Requested Status
Gary Poster (community) release-critical 2010-01-26 Approve on 2010-01-26
Deryck Hodge (community) code 2010-01-26 Approve on 2010-01-26
Review via email: mp+18077@code.launchpad.net
To post a comment you must log in.
Eleanor Berger (intellectronica) wrote :

This branch backs out the change to the sorting of the 'hot bugs' on the bugs home page. We suspect that it may be responsible for that page timing out.

Deryck Hodge (deryck) wrote :

Looks good. Please run the bugs module tests to ensure no other tests are affected, too.

review: Approve (code)
Gary Poster (gary) wrote :

Thank you, Tom and Deryck.

Gary

review: Approve (release-critical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/bugtarget.py'
2--- lib/lp/bugs/browser/bugtarget.py 2010-01-21 17:54:53 +0000
3+++ lib/lp/bugs/browser/bugtarget.py 2010-01-26 14:29:14 +0000
4@@ -40,7 +40,6 @@
5 from canonical.config import config
6 from lp.bugs.browser.bugtask import BugTaskSearchListingView
7 from lp.bugs.interfaces.bug import IBug
8-from lp.bugs.interfaces.bugtask import BugTaskSearchParams
9 from canonical.launchpad.browser.feeds import (
10 BugFeedLink, BugTargetLatestBugsFeedLink, FeedsMixin,
11 PersonLatestBugsFeedLink)
12@@ -56,7 +55,6 @@
13 from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
14 from canonical.launchpad.interfaces.temporaryblobstorage import (
15 ITemporaryStorageManager)
16-from canonical.launchpad.searchbuilder import any
17 from canonical.launchpad.webapp import urlappend
18 from canonical.launchpad.webapp.breadcrumb import Breadcrumb
19 from canonical.launchpad.webapp.interfaces import ILaunchBag, NotFoundError
20@@ -1254,25 +1252,6 @@
21 else:
22 return 'None specified'
23
24- @property
25- def hot_bugs(self):
26- """Return the 10 hotest bugs according to IBug.heat."""
27- params = BugTaskSearchParams(
28- orderby=['-heat', '-date_last_updated'], omit_dupes=True,
29- user=self.user, status=any(*UNRESOLVED_BUGTASK_STATUSES))
30- bugtasks = self.context.searchTasks(params)
31- hot_bugs = []
32- count = 0
33- for task in bugtasks:
34- # Ensure we only represent a bug once in the list.
35- if task.bug not in [hot_task.bug for hot_task in hot_bugs]:
36- if count < 10:
37- hot_bugs.append(task)
38- count += 1
39- else:
40- break
41- return hot_bugs
42-
43
44 class BugTargetBugTagsView(LaunchpadView):
45 """Helper methods for rendering the bug tags portlet."""
46
47=== modified file 'lib/lp/bugs/browser/bugtask.py'
48--- lib/lp/bugs/browser/bugtask.py 2010-01-25 14:50:42 +0000
49+++ lib/lp/bugs/browser/bugtask.py 2010-01-26 14:29:14 +0000
50@@ -2739,6 +2739,15 @@
51 return IDistributionSourcePackage(self.context, None)
52
53 @property
54+ def hot_bugtasks(self):
55+ """Return the 10 most recently updated bugtasks for this target."""
56+ params = BugTaskSearchParams(
57+ orderby="-date_last_updated", omit_dupes=True, user=self.user,
58+ status=any(*UNRESOLVED_BUGTASK_STATUSES))
59+ search = self.context.searchTasks(params)
60+ return list(search[:10])
61+
62+ @property
63 def addquestion_url(self):
64 """Return the URL for the +addquestion view for the context."""
65 if IQuestionTarget.providedBy(self.context):
66
67=== modified file 'lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt'
68--- lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt 2010-01-22 16:33:41 +0000
69+++ lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt 2010-01-26 14:29:14 +0000
70@@ -131,68 +131,38 @@
71
72 == Hot Bugs ==
73
74-A listing of the 10 'hottest' bugs is displayed to allow a quick
75-overview of the project.
76-
77-To demonstrate this, we create 10 bugs and adjust their heat values manually.
78-
79- >>> from zope.component import getUtility
80- >>> from canonical.launchpad.ftests import login, logout
81- >>> from lp.registry.interfaces.product import IProductSet
82- >>> import transaction
83- >>> login('foo.bar@canonical.com')
84- >>> firefox = getUtility(IProductSet).getByName("firefox")
85- >>> heat_values = [0, 400, 200, 600, 100, 50, 50, 50, 50, 50, 50, 50]
86- >>> for count in range(1, 11):
87- ... summary = 'Summary for new bug %d' % count
88- ... bug = factory.makeBug(title=summary, product=firefox)
89- ... bug.setHeat(heat_values[count])
90- >>> transaction.commit()
91- >>> logout()
92-
93+A listing of the 10 'hottest' bugs (currently simply the bugs most
94+recently touched) is displayed to allow a quick overview of the project.
95 For each bug we have the number, title, status, importance and the time
96 since the last update.
97
98 >>> anon_browser.open('http://bugs.launchpad.dev/firefox')
99 >>> print extract_text(
100 ... find_tag_by_id(anon_browser.contents, 'hot-bugs'))
101- Summary Status Importance Last changed
102- #18 Summary for new bug 3 New Undecided ...
103- #16 Summary for new bug 1 New Undecided ...
104- #17 Summary for new bug 2 New Undecided ...
105- #19 Summary for new bug 4 New Undecided ...
106- #25 Summary for new bug 10 New Undecided ...
107- #22 Summary for new bug 7 New Undecided ...
108- #23 Summary for new bug 8 New Undecided ...
109- #24 Summary for new bug 9 New Undecided ...
110- #20 Summary for new bug 5 New Undecided ...
111- #21 Summary for new bug 6 New Undecided ...
112-
113-
114-Fix Released bugs are not shown. We demonstrate this by setting the bugtask
115-for bug 18 to be "Fix Released".
116-
117+ Summary Status Importance Last changed
118+ #5 Firefox install... New Critical on 2006-07-14
119+ #4 Reflow problems... New Medium on 2006-07-14
120+ #1 Firefox does no... New Low on 2006-05-19
121+
122+
123+Fix released bugs are not shown. We demonstrate this by setting the bugtask
124+for bug 4 to be "Fix released".
125+
126+ >>> from zope.component import getUtility
127 >>> from lp.bugs.interfaces.bug import BugTaskStatus, IBugSet
128 >>> from lp.registry.interfaces.person import IPersonSet
129 >>> login('foo.bar@canonical.com')
130- >>> bug_18 = getUtility(IBugSet).get(18)
131+ >>> bug_4 = getUtility(IBugSet).get(4)
132 >>> project_owner = getUtility(IPersonSet).getByName('name12')
133- >>> bug_18.bugtasks[0].transitionToStatus(
134+ >>> bug_4.bugtasks[0].transitionToStatus(
135 ... BugTaskStatus.FIXRELEASED, project_owner)
136 >>> logout()
137
138-And then reloading the page. The Fix Released bug, bug 18, is no longer shown.
139+And then reloading the page. The Fix released bug, bug 4, is no longer shown.
140
141 >>> anon_browser.reload()
142 >>> print extract_text(
143 ... find_tag_by_id(anon_browser.contents, 'hot-bugs'))
144- Summary Status Importance Last changed
145- #16 Summary for new bug 1 New Undecided ...
146- #17 Summary for new bug 2 New Undecided ...
147- #19 Summary for new bug 4 New Undecided ...
148- #25 Summary for new bug 10 New Undecided ...
149- #22 Summary for new bug 7 New Undecided ...
150- #23 Summary for new bug 8 New Undecided ...
151- #24 Summary for new bug 9 New Undecided ...
152- #20 Summary for new bug 5 New Undecided ...
153- #21 Summary for new bug 6 New Undecided ...
154+ Summary Status Importance Last changed
155+ #5 Firefox install... New Critical on 2006-07-14
156+ #1 Firefox does no... New Low on 2006-05-19
157
158=== modified file 'lib/lp/bugs/templates/bugtarget-bugs.pt'
159--- lib/lp/bugs/templates/bugtarget-bugs.pt 2010-01-22 16:33:41 +0000
160+++ lib/lp/bugs/templates/bugtarget-bugs.pt 2010-01-26 14:29:14 +0000
161@@ -95,7 +95,7 @@
162 </ul>
163 </div>
164
165- <tal:has_hot_bugs condition="view/hot_bugs">
166+ <tal:has_hot_bugs condition="view/hot_bugtasks">
167 <div class="search-box">
168 <metal:search
169 use-macro="context/@@+bugtarget-macros-search/simple-search-form"
170@@ -123,7 +123,7 @@
171 </tr>
172 </thead>
173 <tbody>
174- <tr tal:repeat="bugtask view/hot_bugs">
175+ <tr tal:repeat="bugtask view/hot_bugtasks">
176 <td class="icon left">
177 <span tal:replace="structure bugtask/image:icon" />
178 </td>
179@@ -148,7 +148,7 @@
180 </table>
181 </tal:has_hot_bugs>
182
183- <tal:no_hot_bugs condition="not: view/hot_bugs">
184+ <tal:no_hot_bugs condition="not: view/hot_bugtasks">
185 <p id="no-bugs-filed"><strong>There are currently no bugs filed against
186 <tal:project_title replace="context/title" />.</strong></p>
187

Subscribers

People subscribed via source and target branches

to status/vote changes: