Improve number formatting on platform-admin page

Minor changes to the number formatting for the `/platform-admin` page to
- Show the complaint percentage to 2 decimal places. (The number of
complaints is often below 0.0% so 1 decimal place isn't useful)
- Format the numbers in the status boxes to use a comma as a thousands
separator.
This commit is contained in:
Katie Smith
2018-08-14 13:34:53 +01:00
parent 6249f4826b
commit 6b5eaf7fff
2 changed files with 13 additions and 3 deletions

View File

@@ -52,6 +52,13 @@ def get_formatted_percentage(x, tot):
return "{0:.1f}".format((float(x) / tot * 100)) if tot else '0'
def get_formatted_percentage_two_dp(x, tot):
"""
Return a percentage to two decimal places
"""
return "{0:.2f}".format((float(x) / tot * 100)) if tot else '0'
def statistics_by_state(statistics):
return {
'sms': {