Merge lp:~salgado/launchpad/bug-434349 into lp:launchpad

Proposed by Guilherme Salgado
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~salgado/launchpad/bug-434349
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~salgado/launchpad/bug-434349
Reviewer Review Type Date Requested Status
Brad Crittenden (community) release-critical Approve
Curtis Hovey (community) Approve
Review via email: mp+12239@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Guilherme Salgado (salgado) wrote :

= Summary =

Fix the bug by only displaying bugs/blueprints summary for active
milestones

== Tests ==

./bin/test -vvt milestone-views.txt

== Demo and Q/A ==

https://staging.launchpad.net/ubuntu/jaunty

It may timeout on staging, but it will certainly perform much better on
production. Still not ideal, but good enough.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/registry/templates/productseries-milestone-table-row.pt
  lib/lp/registry/browser/tests/milestone-views.txt
  lib/lp/registry/browser/__init__.py
  lib/lp/registry/browser/milestone.py

Revision history for this message
Curtis Hovey (sinzui) wrote :

This is great. Thanks for the cleanup. We can certainly use this code even if we improve the performance issues.

review: Approve
Revision history for this message
Brad Crittenden (bac) wrote :

I think the milestone queries may need some optimization but this fix should work for now. Thanks for taking it on.

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/registry/browser/__init__.py'
2--- lib/lp/registry/browser/__init__.py 2009-09-10 17:15:46 +0000
3+++ lib/lp/registry/browser/__init__.py 2009-09-22 16:21:12 +0000
4@@ -6,7 +6,7 @@
5 __metaclass__ = type
6
7 __all__ = [
8- 'get_status_count',
9+ 'get_status_counts',
10 'MilestoneOverlayMixin',
11 'RegistryEditFormView',
12 'RegistryDeleteViewMixin',
13
14=== modified file 'lib/lp/registry/browser/milestone.py'
15--- lib/lp/registry/browser/milestone.py 2009-09-15 01:42:42 +0000
16+++ lib/lp/registry/browser/milestone.py 2009-09-22 16:24:23 +0000
17@@ -25,7 +25,6 @@
18
19 from canonical.cachedproperty import cachedproperty
20 from canonical.launchpad import _
21-from canonical.lazr.utils import smartquote
22 from lp.bugs.browser.bugtask import BugTaskListingItem
23 from lp.bugs.interfaces.bugtask import (
24 BugTaskSearchParams, IBugTaskSet)
25@@ -155,6 +154,11 @@
26 self.processDeleteFiles()
27
28 @property
29+ def should_show_bugs_and_blueprints(self):
30+ """Display the summary of bugs/blueprints for this milestone?"""
31+ return (not self.show_series_context) and self.milestone.active
32+
33+ @property
34 def page_title(self):
35 """Return the HTML page title."""
36 return self.context.title
37
38=== modified file 'lib/lp/registry/browser/tests/milestone-views.txt'
39--- lib/lp/registry/browser/tests/milestone-views.txt 2009-09-17 02:38:00 +0000
40+++ lib/lp/registry/browser/tests/milestone-views.txt 2009-09-22 16:21:12 +0000
41@@ -83,6 +83,20 @@
42 ... print spec.title
43 dodo
44
45+On a IDistroSeries/IProductSeries main page, we use this view to list detailed
46+information about the context's milestones. However, generating the summary of
47+bugs/blueprints for a milestone is rather expensive, so we only do that for
48+active milestones.
49+
50+ >>> milestone.active
51+ True
52+ >>> view.should_show_bugs_and_blueprints
53+ True
54+
55+ >>> milestone.active = False
56+ >>> view.should_show_bugs_and_blueprints
57+ False
58+
59 The bugtasks are decorated. They are wrapped by the BugTaskListingItem
60 that has cached information to create badges quickly. The
61 _bug_badge_properties property provides the additional information that
62
63=== modified file 'lib/lp/registry/templates/productseries-milestone-table-row.pt'
64--- lib/lp/registry/templates/productseries-milestone-table-row.pt 2009-09-11 14:03:37 +0000
65+++ lib/lp/registry/templates/productseries-milestone-table-row.pt 2009-09-22 16:21:12 +0000
66@@ -71,7 +71,8 @@
67 <td>
68 <tal:summary
69 content="structure milestone/summary/fmt:shorten/80" />
70- <tal:bug-blueprint-details condition="not: view/show_series_context">
71+ <tal:bug-blueprint-details
72+ condition="view/should_show_bugs_and_blueprints">
73 <tal:bugtasks condition="view/bugtasks">
74 <br tal:omit-tag="not: view/milestone/summary" />
75 Bugs targeted:
76