Skip to content

Commit

Permalink
"plus" symbol misplace fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lnxpy committed Aug 22, 2022
1 parent fff8894 commit 07c35ec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions snippet/templatetags/millify.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@register.filter
def millify(n):
mill_names = ["", "K+", "M+"]
mill_names = ["", "K", "M"]
n = float(n)
mill_idx = max(
0,
Expand All @@ -15,5 +15,7 @@ def millify(n):
int(floor(0 if n == 0 else log10(abs(n)) / 3)),
),
)

is_more = '+' if mill_names[mill_idx] else ''

return "{:.0f}{}".format(n / 10 ** (3 * mill_idx), mill_names[mill_idx])
return "{}{:.0f}{}".format(is_more, n / 10 ** (3 * mill_idx), mill_names[mill_idx])

0 comments on commit 07c35ec

Please sign in to comment.