]> git.phdru.name Git - phdru.name/phdru.name.git/commitdiff
Fix(reindex_blog): Sort tags
authorOleg Broytman <phd@phdru.name>
Wed, 2 Oct 2024 14:44:07 +0000 (17:44 +0300)
committerOleg Broytman <phd@phdru.name>
Wed, 2 Oct 2024 14:44:07 +0000 (17:44 +0300)
Sort by count descending; for the same count sort by name ascending.

reindex_blog.py

index 3370d6f892b7896aab65257b6b22cd4efc6658ae..3b4e10de1375851bf5908ae0644008b27cd445e5 100755 (executable)
@@ -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)