From 5c205cd7538f9e00ab2395db1060e73ca1c136cb Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Thu, 20 Mar 2025 14:29:57 -0700 Subject: [PATCH] fix: use rounding instead of truncation for star counts --- scripts/badges.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/badges.py b/scripts/badges.py index a7a1b7cd8..ddcfb5213 100755 --- a/scripts/badges.py +++ b/scripts/badges.py @@ -209,13 +209,13 @@ def get_badges_html(): if stars is None: stars_formatted = "0" elif stars >= 1_000_000_000: - stars_formatted = f"{stars // 1_000_000_000}B" + stars_formatted = f"{round(stars / 1_000_000_000)}B" elif stars >= 1_000_000: - stars_formatted = f"{stars // 1_000_000}M" + stars_formatted = f"{round(stars / 1_000_000)}M" elif stars >= 1_000: - stars_formatted = f"{stars // 1_000}K" + stars_formatted = f"{round(stars / 1_000)}K" else: - stars_formatted = str(stars) + stars_formatted = str(int(round(stars))) aider_percent_rounded = round(percentage) # Generate HTML badges