From 2239c5950dce78aad0c7e94f3305b8d897142cf4 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 2 Oct 2024 17:44:07 +0300 Subject: [PATCH] Fix(reindex_blog): Sort tags Sort by count descending; for the same count sort by name ascending. --- reindex_blog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reindex_blog.py b/reindex_blog.py index 3370d6f..3b4e10d 100755 --- a/reindex_blog.py +++ b/reindex_blog.py @@ -321,7 +321,7 @@ def by_count_rev_tag_link(tag): """Sort all_tags by count in descending order, and by tags and links in ascending order """ - return tag[:3] + return -tag[0], tag[1], tag[2] all_tags = [(len(links), tag, links) for (tag, links) in all_tags.items()] all_tags.sort(key=by_count_rev_tag_link) -- 2.39.5