From f23dd1f1cbe81f01e4f878ac11ee064b6c7d70ec Mon Sep 17 00:00:00 2001 From: iBug Date: Wed, 6 Sep 2023 16:13:47 +0800 Subject: [PATCH] count_reactions: GitHub doesn't show issue titles in top-level tables --- scripts/count_reactions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/count_reactions.py b/scripts/count_reactions.py index accc92b..dbd709e 100644 --- a/scripts/count_reactions.py +++ b/scripts/count_reactions.py @@ -22,12 +22,12 @@ def count_reactions(token, repo_name): down_dates.add(date) reactions_count[issue.number] = (len(up_dates), len(down_dates)) - sorted_reactions_count = sorted(reactions_count.items(), key=lambda item: (item[1][0] - item[1][1], item[0]), reverse=True) + sorted_reactions_count = sorted(reactions_count.items(), key=lambda item: (item[1][0] - item[1][1], -item[0]), reverse=True) - table = "## Votes\n\n| Title| Priority | Score |\n| --- | --- | --- |\n" + table = "* Votes:\n \n | Title | Priority | Score |\n | --- | --- | --- |\n" for issue_number, (up_count, down_count) in sorted_reactions_count: score = up_count - down_count - table += f"| #{issue_number} | {score} | +{up_count}, -{down_count} |\n" + table += f" | #{issue_number} | {score} | +{up_count}, -{down_count} |\n" repo.get_issue(366).edit(body=table)