launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26368
[Merge] ~cjwatson/launchpad:py3-sort-bug-tags into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-sort-bug-tags into launchpad:master.
Commit message:
Sort bug tags more completely
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398368
The tags portlet sorted tags by count, but the order of tags with the same count was non-deterministic. Sort tags with the same count lexicographically.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-sort-bug-tags into launchpad:master.
diff --git a/lib/lp/bugs/browser/bugtarget.py b/lib/lp/bugs/browser/bugtarget.py
index e25187c..51b67bd 100644
--- a/lib/lp/bugs/browser/bugtarget.py
+++ b/lib/lp/bugs/browser/bugtarget.py
@@ -22,7 +22,6 @@ __all__ = [
from datetime import datetime
from functools import partial
from io import BytesIO
-from operator import itemgetter
from lazr.restful.interface import copy_field
from lazr.restful.interfaces import IJSONRequestCache
@@ -1228,7 +1227,7 @@ class BugTargetBugTagsView(LaunchpadView):
url=self._getSearchURL(tag),
)
for (tag, count) in six.iteritems(tags)],
- key=itemgetter('count'), reverse=True)
+ key=lambda item: (-item['count'], item['tag']))
@property
def show_manage_tags_link(self):
diff --git a/lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-listings-page.txt b/lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-listings-page.txt
index ef8b671..268b470 100644
--- a/lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-listings-page.txt
+++ b/lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-listings-page.txt
@@ -10,8 +10,8 @@ using Javascript after page load.
>>> for a_tag in tags_portlet('a'):
... print(a_tag.decode_contents())
crash
- pebcak
dataloss
+ pebcak
If we click on a tag, only bugs with that tag are displayed:
diff --git a/lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt b/lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt
index 3974b34..5d17888 100644
--- a/lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt
+++ b/lib/lp/bugs/stories/bugs/xx-product-bugs-page.txt
@@ -116,9 +116,9 @@ loaded using Javascript in a separate request.
>>> print(extract_text(anon_browser.contents))
Tags
1
- layout-test
- 1
doc
+ 1
+ layout-test
They are there to provide easy navigation for bugs with a certain
tag...