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

Proposed by Eleanor Berger
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 Approve
Deryck Hodge (community) code Approve
Review via email: mp+18077@code.launchpad.net
To post a comment you must log in.
Revision history for this message
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.

Revision history for this message
Deryck Hodge (deryck) wrote :

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

review: Approve (code)
Revision history for this message
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
=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py 2010-01-21 17:54:53 +0000
+++ lib/lp/bugs/browser/bugtarget.py 2010-01-26 14:29:14 +0000
@@ -40,7 +40,6 @@
40from canonical.config import config40from canonical.config import config
41from lp.bugs.browser.bugtask import BugTaskSearchListingView41from lp.bugs.browser.bugtask import BugTaskSearchListingView
42from lp.bugs.interfaces.bug import IBug42from lp.bugs.interfaces.bug import IBug
43from lp.bugs.interfaces.bugtask import BugTaskSearchParams
44from canonical.launchpad.browser.feeds import (43from canonical.launchpad.browser.feeds import (
45 BugFeedLink, BugTargetLatestBugsFeedLink, FeedsMixin,44 BugFeedLink, BugTargetLatestBugsFeedLink, FeedsMixin,
46 PersonLatestBugsFeedLink)45 PersonLatestBugsFeedLink)
@@ -56,7 +55,6 @@
56from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities55from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
57from canonical.launchpad.interfaces.temporaryblobstorage import (56from canonical.launchpad.interfaces.temporaryblobstorage import (
58 ITemporaryStorageManager)57 ITemporaryStorageManager)
59from canonical.launchpad.searchbuilder import any
60from canonical.launchpad.webapp import urlappend58from canonical.launchpad.webapp import urlappend
61from canonical.launchpad.webapp.breadcrumb import Breadcrumb59from canonical.launchpad.webapp.breadcrumb import Breadcrumb
62from canonical.launchpad.webapp.interfaces import ILaunchBag, NotFoundError60from canonical.launchpad.webapp.interfaces import ILaunchBag, NotFoundError
@@ -1254,25 +1252,6 @@
1254 else:1252 else:
1255 return 'None specified'1253 return 'None specified'
12561254
1257 @property
1258 def hot_bugs(self):
1259 """Return the 10 hotest bugs according to IBug.heat."""
1260 params = BugTaskSearchParams(
1261 orderby=['-heat', '-date_last_updated'], omit_dupes=True,
1262 user=self.user, status=any(*UNRESOLVED_BUGTASK_STATUSES))
1263 bugtasks = self.context.searchTasks(params)
1264 hot_bugs = []
1265 count = 0
1266 for task in bugtasks:
1267 # Ensure we only represent a bug once in the list.
1268 if task.bug not in [hot_task.bug for hot_task in hot_bugs]:
1269 if count < 10:
1270 hot_bugs.append(task)
1271 count += 1
1272 else:
1273 break
1274 return hot_bugs
1275
12761255
1277class BugTargetBugTagsView(LaunchpadView):1256class BugTargetBugTagsView(LaunchpadView):
1278 """Helper methods for rendering the bug tags portlet."""1257 """Helper methods for rendering the bug tags portlet."""
12791258
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2010-01-25 14:50:42 +0000
+++ lib/lp/bugs/browser/bugtask.py 2010-01-26 14:29:14 +0000
@@ -2739,6 +2739,15 @@
2739 return IDistributionSourcePackage(self.context, None)2739 return IDistributionSourcePackage(self.context, None)
27402740
2741 @property2741 @property
2742 def hot_bugtasks(self):
2743 """Return the 10 most recently updated bugtasks for this target."""
2744 params = BugTaskSearchParams(
2745 orderby="-date_last_updated", omit_dupes=True, user=self.user,
2746 status=any(*UNRESOLVED_BUGTASK_STATUSES))
2747 search = self.context.searchTasks(params)
2748 return list(search[:10])
2749
2750 @property
2742 def addquestion_url(self):2751 def addquestion_url(self):
2743 """Return the URL for the +addquestion view for the context."""2752 """Return the URL for the +addquestion view for the context."""
2744 if IQuestionTarget.providedBy(self.context):2753 if IQuestionTarget.providedBy(self.context):
27452754
=== modified file 'lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt'
--- lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt 2010-01-22 16:33:41 +0000
+++ lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt 2010-01-26 14:29:14 +0000
@@ -131,68 +131,38 @@
131131
132== Hot Bugs ==132== Hot Bugs ==
133133
134A listing of the 10 'hottest' bugs is displayed to allow a quick134A listing of the 10 'hottest' bugs (currently simply the bugs most
135overview of the project.135recently touched) is displayed to allow a quick overview of the project.
136
137To demonstrate this, we create 10 bugs and adjust their heat values manually.
138
139 >>> from zope.component import getUtility
140 >>> from canonical.launchpad.ftests import login, logout
141 >>> from lp.registry.interfaces.product import IProductSet
142 >>> import transaction
143 >>> login('foo.bar@canonical.com')
144 >>> firefox = getUtility(IProductSet).getByName("firefox")
145 >>> heat_values = [0, 400, 200, 600, 100, 50, 50, 50, 50, 50, 50, 50]
146 >>> for count in range(1, 11):
147 ... summary = 'Summary for new bug %d' % count
148 ... bug = factory.makeBug(title=summary, product=firefox)
149 ... bug.setHeat(heat_values[count])
150 >>> transaction.commit()
151 >>> logout()
152
153For each bug we have the number, title, status, importance and the time136For each bug we have the number, title, status, importance and the time
154since the last update.137since the last update.
155138
156 >>> anon_browser.open('http://bugs.launchpad.dev/firefox')139 >>> anon_browser.open('http://bugs.launchpad.dev/firefox')
157 >>> print extract_text(140 >>> print extract_text(
158 ... find_tag_by_id(anon_browser.contents, 'hot-bugs'))141 ... find_tag_by_id(anon_browser.contents, 'hot-bugs'))
159 Summary Status Importance Last changed142 Summary Status Importance Last changed
160 #18 Summary for new bug 3 New Undecided ...143 #5 Firefox install... New Critical on 2006-07-14
161 #16 Summary for new bug 1 New Undecided ...144 #4 Reflow problems... New Medium on 2006-07-14
162 #17 Summary for new bug 2 New Undecided ...145 #1 Firefox does no... New Low on 2006-05-19
163 #19 Summary for new bug 4 New Undecided ...146
164 #25 Summary for new bug 10 New Undecided ...147
165 #22 Summary for new bug 7 New Undecided ...148Fix released bugs are not shown. We demonstrate this by setting the bugtask
166 #23 Summary for new bug 8 New Undecided ...149for bug 4 to be "Fix released".
167 #24 Summary for new bug 9 New Undecided ...150
168 #20 Summary for new bug 5 New Undecided ...151 >>> from zope.component import getUtility
169 #21 Summary for new bug 6 New Undecided ...
170
171
172Fix Released bugs are not shown. We demonstrate this by setting the bugtask
173for bug 18 to be "Fix Released".
174
175 >>> from lp.bugs.interfaces.bug import BugTaskStatus, IBugSet152 >>> from lp.bugs.interfaces.bug import BugTaskStatus, IBugSet
176 >>> from lp.registry.interfaces.person import IPersonSet153 >>> from lp.registry.interfaces.person import IPersonSet
177 >>> login('foo.bar@canonical.com')154 >>> login('foo.bar@canonical.com')
178 >>> bug_18 = getUtility(IBugSet).get(18)155 >>> bug_4 = getUtility(IBugSet).get(4)
179 >>> project_owner = getUtility(IPersonSet).getByName('name12')156 >>> project_owner = getUtility(IPersonSet).getByName('name12')
180 >>> bug_18.bugtasks[0].transitionToStatus(157 >>> bug_4.bugtasks[0].transitionToStatus(
181 ... BugTaskStatus.FIXRELEASED, project_owner)158 ... BugTaskStatus.FIXRELEASED, project_owner)
182 >>> logout()159 >>> logout()
183160
184And then reloading the page. The Fix Released bug, bug 18, is no longer shown.161And then reloading the page. The Fix released bug, bug 4, is no longer shown.
185162
186 >>> anon_browser.reload()163 >>> anon_browser.reload()
187 >>> print extract_text(164 >>> print extract_text(
188 ... find_tag_by_id(anon_browser.contents, 'hot-bugs'))165 ... find_tag_by_id(anon_browser.contents, 'hot-bugs'))
189 Summary Status Importance Last changed166 Summary Status Importance Last changed
190 #16 Summary for new bug 1 New Undecided ...167 #5 Firefox install... New Critical on 2006-07-14
191 #17 Summary for new bug 2 New Undecided ...168 #1 Firefox does no... New Low on 2006-05-19
192 #19 Summary for new bug 4 New Undecided ...
193 #25 Summary for new bug 10 New Undecided ...
194 #22 Summary for new bug 7 New Undecided ...
195 #23 Summary for new bug 8 New Undecided ...
196 #24 Summary for new bug 9 New Undecided ...
197 #20 Summary for new bug 5 New Undecided ...
198 #21 Summary for new bug 6 New Undecided ...
199169
=== modified file 'lib/lp/bugs/templates/bugtarget-bugs.pt'
--- lib/lp/bugs/templates/bugtarget-bugs.pt 2010-01-22 16:33:41 +0000
+++ lib/lp/bugs/templates/bugtarget-bugs.pt 2010-01-26 14:29:14 +0000
@@ -95,7 +95,7 @@
95 </ul>95 </ul>
96 </div>96 </div>
9797
98 <tal:has_hot_bugs condition="view/hot_bugs">98 <tal:has_hot_bugs condition="view/hot_bugtasks">
99 <div class="search-box">99 <div class="search-box">
100 <metal:search100 <metal:search
101 use-macro="context/@@+bugtarget-macros-search/simple-search-form"101 use-macro="context/@@+bugtarget-macros-search/simple-search-form"
@@ -123,7 +123,7 @@
123 </tr>123 </tr>
124 </thead>124 </thead>
125 <tbody>125 <tbody>
126 <tr tal:repeat="bugtask view/hot_bugs">126 <tr tal:repeat="bugtask view/hot_bugtasks">
127 <td class="icon left">127 <td class="icon left">
128 <span tal:replace="structure bugtask/image:icon" />128 <span tal:replace="structure bugtask/image:icon" />
129 </td>129 </td>
@@ -148,7 +148,7 @@
148 </table>148 </table>
149 </tal:has_hot_bugs>149 </tal:has_hot_bugs>
150150
151 <tal:no_hot_bugs condition="not: view/hot_bugs">151 <tal:no_hot_bugs condition="not: view/hot_bugtasks">
152 <p id="no-bugs-filed"><strong>There are currently no bugs filed against152 <p id="no-bugs-filed"><strong>There are currently no bugs filed against
153 <tal:project_title replace="context/title" />.</strong></p>153 <tal:project_title replace="context/title" />.</strong></p>
154154

Subscribers

People subscribed via source and target branches

to status/vote changes: