Merge lp:~brian-murray/launchpad/bug-485229 into lp:launchpad/db-devel

Proposed by Brian Murray
Status: Merged
Approved by: Deryck Hodge
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~brian-murray/launchpad/bug-485229
Merge into: lp:launchpad/db-devel
Diff against target: 183 lines (+36/-23)
6 files modified
lib/canonical/launchpad/icing/style-3-0.css (+6/-1)
lib/canonical/launchpad/templates/root-index.pt (+5/-5)
lib/lp/bugs/browser/bugtarget.py (+1/-1)
lib/lp/registry/browser/root.py (+1/-6)
lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt (+15/-9)
sourcecode/Makefile (+8/-1)
To merge this branch: bzr merge lp:~brian-murray/launchpad/bug-485229
Reviewer Review Type Date Requested Status
Paul Hummer (community) Approve
Deryck Hodge (community) code Approve
Review via email: mp+15040@code.launchpad.net

Commit message

Modify sorting of unofficial tags so that the most popular ones are returned.

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

Fix the sorting of popular bug tags by using reverse.

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

As we talked about here at UDS, I think we need a test to confirm this change produces the condition we expect -- i.e. that only the ten top tags are showing in the portlet.

I'll work up a test for you sometime in the next couple of days to demonstrate this.

review: Needs Fixing (code)
Revision history for this message
Deryck Hodge (deryck) wrote :

Here's the test I added:

=== modified file 'lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt'
--- lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt 2009-09-22 19:57:40 +0000
+++ lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt 2009-11-20 16:46:24 +0000
@@ -139,6 +139,53 @@
     unofficial-tag-09
     unofficial-tag-10

+The 10 unofficial tags will be the 10 most popular tags. To demonstrate
+this, two additional bugs are created and unofficial tags 11 and 12 are
+added to those bugs.
+
+ >>> login('<email address hidden>')
+ >>> watersocks = factory.makeProduct(name='watersocks')
+ >>> watersocks_bugs_url = canonical_url(watersocks, rootsite='bugs')
+ >>> watersocks.official_bug_tags = [
+ ... u'official-tag-%02d' % idx for idx in range(1, 13)]
+ >>> ws_bug = factory.makeBug(product=watersocks)
+ >>> ws_bug.tags = [
+ ... u'unofficial-tag-%02d' % idx for idx in range(1, 13)]
+ >>> ws_bug_two = factory.makeBug(product=watersocks)
+ >>> ws_bug_two.tags = [u'unofficial-tag-11', u'unofficial-tag-12']
+ >>> ws_bug_three = factory.makeBug(product=watersocks)
+ >>> ws_bug_three.tags = [u'unofficial-tag-11', u'unofficial-tag-12']
+ >>> transaction.commit()
+ >>> logout()
+
+ >>> browser.open(watersocks_bugs_url + '/+bugtarget-portlet-tags-content')
+ >>> print_tags_portlet(browser.contents)
+ Tags
+ ----
+ official-tag-01
+ official-tag-02
+ official-tag-03
+ official-tag-04
+ official-tag-05
+ official-tag-06
+ official-tag-07
+ official-tag-08
+ official-tag-09
+ official-tag-10
+ official-tag-11
+ official-tag-12
+ unofficial-tag-01
+ unofficial-tag-02
+ unofficial-tag-03
+ unofficial-tag-04
+ unofficial-tag-05
+ unofficial-tag-06
+ unofficial-tag-07
+ unofficial-tag-08
+ unofficial-tag-11
+ unofficial-tag-12
+
+
 == Entering Official Tags ==

 === Available Official Tags in Javascript ===

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

Approved for brian's part. rockstar will review mine test.

review: Approve (code)
Revision history for this message
Paul Hummer (rockstar) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/icing/style-3-0.css'
--- lib/canonical/launchpad/icing/style-3-0.css 2009-11-13 17:49:40 +0000
+++ lib/canonical/launchpad/icing/style-3-0.css 2009-11-19 15:05:35 +0000
@@ -471,13 +471,18 @@
471ol.subordinate {471ol.subordinate {
472 margin-left: 4em;472 margin-left: 4em;
473 }473 }
474.two-column-list li,
475.two-column-list dl {474.two-column-list dl {
476 width: 48%;475 width: 48%;
477 float: left;476 float: left;
478 display: inline;477 display: inline;
479 margin: 0 0.25em 0.75em 0;478 margin: 0 0.25em 0.75em 0;
480 }479 }
480.two-column-list li {
481 width: 48%;
482 float: left;
483 display: inline;
484 margin: 0 0.25em 0 0;
485 }
481.two-column-list:after {486.two-column-list:after {
482 content: ".";487 content: ".";
483 display: block;488 display: block;
484489
=== modified file 'lib/canonical/launchpad/templates/root-index.pt'
--- lib/canonical/launchpad/templates/root-index.pt 2009-11-13 18:03:35 +0000
+++ lib/canonical/launchpad/templates/root-index.pt 2009-11-19 15:05:35 +0000
@@ -51,14 +51,14 @@
51 margin-top: 1em;51 margin-top: 1em;
52 font-size: 161%;52 font-size: 161%;
53 }53 }
54 .featured-project h3 {54 .featured-project-top h3 {
55 font-size: 131%;55 font-size: 131%;
56 font-weight: bold;56 font-weight: bold;
57 }57 }
58 .featured-project h3 img {58 .featured-project-top h3 img {
59 vertical-align: middle;59 vertical-align: middle;
60 }60 }
61 .featured-project p {61 .featured-project-top p {
62 margin-top: 0.5em;62 margin-top: 0.5em;
63 margin-bottom: 1em;63 margin-bottom: 1em;
64 border-bottom: 1px solid #888888;64 border-bottom: 1px solid #888888;
@@ -226,7 +226,7 @@
226 <div id="homepage-featured" class="homepage-portlet">226 <div id="homepage-featured" class="homepage-portlet">
227 <h2>Featured projects</h2>227 <h2>Featured projects</h2>
228228
229 <div class="featured-project"229 <div class="featured-project-top"
230 tal:define="topproject view/featured_projects_top"230 tal:define="topproject view/featured_projects_top"
231 tal:condition="topproject">231 tal:condition="topproject">
232 <h3>232 <h3>
@@ -241,7 +241,7 @@
241 </div>241 </div>
242242
243 <div class="two-column-list">243 <div class="two-column-list">
244 <ul id="homepage-featured">244 <ul class="featured-projects-list">
245 <li tal:repeat="project view/featured_projects">245 <li tal:repeat="project view/featured_projects">
246 <a tal:replace="structure project/fmt:link" />246 <a tal:replace="structure project/fmt:link" />
247 </li>247 </li>
248248
=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py 2009-11-06 21:06:38 +0000
+++ lib/lp/bugs/browser/bugtarget.py 2009-11-19 15:05:35 +0000
@@ -1201,7 +1201,7 @@
1201 tags = self.getUsedBugTagsWithURLs()1201 tags = self.getUsedBugTagsWithURLs()
1202 other_tags = [tag for tag in tags if tag['tag'] not in official_tags]1202 other_tags = [tag for tag in tags if tag['tag'] not in official_tags]
1203 popular_tags = [tag['tag'] for tag in sorted(1203 popular_tags = [tag['tag'] for tag in sorted(
1204 other_tags, key=itemgetter('count'))[:10]]1204 other_tags, key=itemgetter('count'), reverse=True)[:10]]
1205 tags = [1205 tags = [
1206 tag for tag in tags1206 tag for tag in tags
1207 if tag['tag'] in official_tags + popular_tags]1207 if tag['tag'] in official_tags + popular_tags]
12081208
=== modified file 'lib/lp/registry/browser/root.py'
--- lib/lp/registry/browser/root.py 2009-11-13 18:23:59 +0000
+++ lib/lp/registry/browser/root.py 2009-11-19 15:05:35 +0000
@@ -54,10 +54,6 @@
54class LaunchpadRootIndexView(HasAnnouncementsView, LaunchpadView):54class LaunchpadRootIndexView(HasAnnouncementsView, LaunchpadView):
55 """An view for the default view of the LaunchpadRoot."""55 """An view for the default view of the LaunchpadRoot."""
5656
57 # The homepage has two columns to hold featured projects. This
58 # determines the number of projects we display in each column.
59 FEATURED_PROJECT_ROWS = 11
60
61 featured_projects = []57 featured_projects = []
62 featured_projects_top = None58 featured_projects_top = None
6359
@@ -75,9 +71,8 @@
75 super(LaunchpadRootIndexView, self).initialize()71 super(LaunchpadRootIndexView, self).initialize()
76 # The maximum number of projects to be displayed as defined by the72 # The maximum number of projects to be displayed as defined by the
77 # number of items plus one top featured project.73 # number of items plus one top featured project.
78 max_projects = self.FEATURED_PROJECT_ROWS + 1
79 self.featured_projects = list(74 self.featured_projects = list(
80 getUtility(IPillarNameSet).featured_projects)[:max_projects]75 getUtility(IPillarNameSet).featured_projects)
81 self._setFeaturedProjectsTop()76 self._setFeaturedProjectsTop()
8277
83 def _setFeaturedProjectsTop(self):78 def _setFeaturedProjectsTop(self):
8479
=== modified file 'lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt'
--- lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt 2009-09-21 14:48:17 +0000
+++ lib/lp/registry/stories/launchpad-root/xx-featuredprojects.txt 2009-11-19 15:05:35 +0000
@@ -19,17 +19,22 @@
19 >>> from lp.registry.browser.root import LaunchpadRootIndexView19 >>> from lp.registry.browser.root import LaunchpadRootIndexView
20 >>> LaunchpadRootIndexView._get_day_of_year = staticmethod(20 >>> LaunchpadRootIndexView._get_day_of_year = staticmethod(
21 ... fake_get_day_of_year)21 ... fake_get_day_of_year)
22
23Anonymous users will see the list of featured projects with links to the
24projects' pages in Launchpad. The "project of the day" is listed separately.
25
22 >>> anon_browser.open('http://launchpad.dev/')26 >>> anon_browser.open('http://launchpad.dev/')
23 >>> featured = find_tag_by_id(anon_browser.contents, 'homepage-featured')27 >>> featured = find_tag_by_id(anon_browser.contents, 'homepage-featured')
24 >>> print extract_text(featured.h2)28 >>> print extract_text(featured.h2)
25 Featured projects29 Featured projects
2630
27We show the featured projects in our sample data, the "project of the day" is31 >>> top_project = featured.find('', 'featured-project-top')
28"GNOME" and it is listed first:32 >>> print extract_text(top_project.h3)
33 GNOME
2934
30 >>> for link in featured.findAll('a'):35 >>> featured_list = featured.find('', 'featured-projects-list')
36 >>> for link in featured_list.findAll('a'):
31 ... print extract_text(link)37 ... print extract_text(link)
32 GNOME
33 Gnome Applets38 Gnome Applets
34 Bazaar39 Bazaar
35 Mozilla Firefox40 Mozilla Firefox
@@ -38,7 +43,6 @@
38 the Mozilla Project43 the Mozilla Project
39 Mozilla Thunderbird44 Mozilla Thunderbird
40 Ubuntu45 Ubuntu
41 Browse all ... projects
4246
43== Adding a featured project ==47== Adding a featured project ==
4448
@@ -88,9 +92,13 @@
8892
89 >>> anon_browser.open('http://launchpad.dev/')93 >>> anon_browser.open('http://launchpad.dev/')
90 >>> featured = find_tag_by_id(anon_browser.contents, 'homepage-featured')94 >>> featured = find_tag_by_id(anon_browser.contents, 'homepage-featured')
91 >>> for link in featured.findAll('a'):95 >>> top_project = featured.find('', 'featured-project-top')
96 >>> print extract_text(top_project.h3)
97 Gentoo
98
99 >>> featured_list = featured.find('', 'featured-projects-list')
100 >>> for link in featured_list.findAll('a'):
92 ... print extract_text(link)101 ... print extract_text(link)
93 Gentoo
94 Apache102 Apache
95 Gnome Applets103 Gnome Applets
96 Bazaar104 Bazaar
@@ -100,8 +108,6 @@
100 the Mozilla Project108 the Mozilla Project
101 Mozilla Thunderbird109 Mozilla Thunderbird
102 Ubuntu110 Ubuntu
103 Browse all ... projects
104
105111
106== Removing a project ==112== Removing a project ==
107113
108114
=== modified file 'sourcecode/Makefile'
--- sourcecode/Makefile 2009-10-31 12:07:16 +0000
+++ sourcecode/Makefile 2009-11-19 15:05:35 +0000
@@ -25,4 +25,11 @@
25 fi;\25 fi;\
26 done26 done
2727
28.PHONY: check all build28clean:
29 @ for subdir in ${build_dirs}; do\
30 if [ -e $$subdir/Makefile ]; then\
31 (cd $$subdir && bzr clean-tree --ignored --force) || exit $$?;\
32 fi;\
33 done
34
35.PHONY: check all build clean

Subscribers

People subscribed via source and target branches

to status/vote changes: