Added another way to handle .0

This commit is contained in:
Lucas
2025-04-10 21:31:35 -07:00
parent bd763efe5f
commit fefb32644f
2 changed files with 19 additions and 1 deletions

View File

@@ -20,6 +20,24 @@ def format_stars(n):
return formatted.replace('.0k', 'k')
else:
return str(n)
'''
def format_stars(n):
if n >= 1_000_000:
value = n / 1_000_000
suffix = "M"
elif n >= 1_000:
value = n / 1_000
suffix = "k"
else:
return str(n)
# If it's a whole number, don't show decimal point
if value == int(value):
return f"{int(value)}{suffix}"
else:
return f"{value:.1f}{suffix}"
'''
def generate_contents(platform="all"):