Merge lp:~deryck/launchpad/hot-bugtasks-to-hot-bugs-442170 into lp:launchpad/db-devel
| Status: | Merged |
|---|---|
| Approved by: | Eleanor Berger on 2010-01-21 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | not available |
| Proposed branch: | lp:~deryck/launchpad/hot-bugtasks-to-hot-bugs-442170 |
| Merge into: | lp:launchpad/db-devel |
| Diff against target: |
186 lines (+72/-30) 4 files modified
lib/lp/bugs/browser/bugtarget.py (+21/-0) lib/lp/bugs/browser/bugtask.py (+0/-9) lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt (+48/-18) lib/lp/bugs/templates/bugtarget-bugs.pt (+3/-3) |
| To merge this branch: | bzr merge lp:~deryck/launchpad/hot-bugtasks-to-hot-bugs-442170 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Eleanor Berger (community) | 2010-01-21 | Approve on 2010-01-21 | |
|
Review via email:
|
|||
Commit Message
Make the method getting a hot bugs list get bugs by heat rather than recently touched bugtasks.
| Deryck Hodge (deryck) wrote : | # |
| Eleanor Berger (intellectronica) wrote : | # |
At last, real hot bugs!!!
We've discussed a few minor changes:
1. Exiting from the loop instead of returning twice in hot_bugs.
2. Accessing bug/prop instead of bug/default_
Everything else looks great.
| Eleanor Berger (intellectronica) wrote : | # |
On further discussion, we realised that there's a subtle problem with using the default_bugtask, since it isn't necessarily a task on the same bugtarget we're viewing. Instead of returning bugs, we should return the task we got back from searchTasks. That does complicate the loop in hot_bugs a bit.
| Deryck Hodge (deryck) wrote : | # |
I believe I've fixed everything now. Latest incremental diff:
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -1264,12 +1264,13 @@
hot_bugs = []
count = 0
for task in bugtasks:
- if task.bug not in hot_bugs:
+ # Ensure we only represent a bug once in the list.
+ if task.bug not in [hot_task.bug for hot_task in hot_bugs]:
if count < 10:
- hot_bugs.
+ hot_bugs.
- elif count == 10:
- return hot_bugs
+ else:
+ break
return hot_bugs
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -1257,7 +1257,7 @@
- "heat": "Bug.hotness",
+ "heat": "Bug.heat",
}
_open_
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -203,8 +203,8 @@
#21 Summary for new bug 6 New Undecided ...
-Fix released bugs are not shown. We demonstrate this by setting the bugtask
-for bug 18 to be "Fix released".
+Fix Released bugs are not shown. We demonstrate this by setting the bugtask
+for bug 18 to be "Fix Released".
>>> from lp.bugs.
>>> from lp.registry.
@@ -215,7 +215,7 @@
... BugTaskStatus.
>>> logout()
-And then reloading the page. The Fix released bug, bug 18, is no longer shown.
+And then reloading the page. The Fix Released bug, bug 18, is no longer shown.
>>> anon_browser.
>>> print extract_text(
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -113,23 +113,23 @@
</tr>
</thead>
<tbody>
- <tr tal:repeat="bug view/hot_bugs">
+ <tr tal:repeat="bugtask view/hot_bugs">
<td class="icon left">
<img alt="" src="/@@/bug" />
</td>
<td style="text-align: right">
- #<span tal:replace=
+ #<span tal:replace=
</td>
<td>
- <a tal:attributes=
- tal:content=
+ <a tal:attributes=
+ tal:content=
...

This branch moves the hot_bugtasks method from the bug listing view to a hot_bugs method on a bug target view, which changes the behavior to return 10 bugs according to heat rather than recently touched bug tasks.
This change also allows us to fix Bug #442170, since the code ensures the same bug isn't shown twice. The code uses default_bugtask for display.
The "hot bugs" test in stories/ bugs/xx- product- bugs-page. txt has been updated to use factory data, rather than sample data, and to test that bugs are listed by heat.
The branch builds on a branch from Tom/Brian M. that allows sorting by heat, so the diff for my changes is pasted:
http:// pastebin. ubuntu. com/360139/