mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Format numbers as millions or billions
This matches the existing performance platform page, and I think is a bit easier to read for high-level numbers where you don’t need to see that they’re changing second-by-second.
This commit is contained in:
@@ -38,6 +38,7 @@ from app.config import configs
|
|||||||
from app.extensions import antivirus_client, redis_client, zendesk_client
|
from app.extensions import antivirus_client, redis_client, zendesk_client
|
||||||
from app.formatters import (
|
from app.formatters import (
|
||||||
convert_to_boolean,
|
convert_to_boolean,
|
||||||
|
format_billions,
|
||||||
format_date,
|
format_date,
|
||||||
format_date_human,
|
format_date_human,
|
||||||
format_date_normal,
|
format_date_normal,
|
||||||
@@ -527,6 +528,7 @@ def setup_event_handlers():
|
|||||||
|
|
||||||
def add_template_filters(application):
|
def add_template_filters(application):
|
||||||
for fn in [
|
for fn in [
|
||||||
|
format_billions,
|
||||||
format_datetime,
|
format_datetime,
|
||||||
format_datetime_24h,
|
format_datetime_24h,
|
||||||
format_datetime_normal,
|
format_datetime_normal,
|
||||||
|
|||||||
@@ -515,3 +515,7 @@ def format_mobile_network(network):
|
|||||||
if network in ('three', 'vodafone', 'o2'):
|
if network in ('three', 'vodafone', 'o2'):
|
||||||
return network.capitalize()
|
return network.capitalize()
|
||||||
return 'EE'
|
return 'EE'
|
||||||
|
|
||||||
|
|
||||||
|
def format_billions(count):
|
||||||
|
return humanize.intword(count)
|
||||||
|
|||||||
@@ -22,28 +22,28 @@
|
|||||||
<div class="govuk-grid-row">
|
<div class="govuk-grid-row">
|
||||||
<div class="govuk-grid-column-one-half">
|
<div class="govuk-grid-column-one-half">
|
||||||
<h3 class="govuk-visually-hidden">Total messages</h3>
|
<h3 class="govuk-visually-hidden">Total messages</h3>
|
||||||
<div class="product-page-big-number">{{ total_notifications }}</div>
|
<div class="product-page-big-number">{{ total_notifications|format_billions }}</div>
|
||||||
total
|
total
|
||||||
</div>
|
</div>
|
||||||
<div class="govuk-grid-column-one-half">
|
<div class="govuk-grid-column-one-half">
|
||||||
<div class="govuk-grid-row govuk-!-padding-top-4">
|
<div class="govuk-grid-row govuk-!-padding-top-4">
|
||||||
<div class="govuk-grid-column-one-third">
|
<div class="govuk-grid-column-one-third">
|
||||||
{{ big_number(
|
{{ big_number(
|
||||||
email_notifications,
|
email_notifications|format_billions,
|
||||||
label=email_notifications|message_count_noun('email'),
|
label=email_notifications|message_count_noun('email'),
|
||||||
smallest=True,
|
smallest=True,
|
||||||
) }}
|
) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="govuk-grid-column-one-third">
|
<div class="govuk-grid-column-one-third">
|
||||||
{{ big_number(
|
{{ big_number(
|
||||||
sms_notifications,
|
sms_notifications|format_billions,
|
||||||
label=sms_notifications|message_count_noun('sms'),
|
label=sms_notifications|message_count_noun('sms'),
|
||||||
smallest=True,
|
smallest=True,
|
||||||
) }}
|
) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="govuk-grid-column-one-third">
|
<div class="govuk-grid-column-one-third">
|
||||||
{{ big_number(
|
{{ big_number(
|
||||||
letter_notifications,
|
letter_notifications|format_billions,
|
||||||
label=letter_notifications|message_count_noun('letter'),
|
label=letter_notifications|message_count_noun('letter'),
|
||||||
smallest=True,
|
smallest=True,
|
||||||
) }}
|
) }}
|
||||||
|
|||||||
@@ -117,10 +117,10 @@ def test_should_render_performance_page(
|
|||||||
''
|
''
|
||||||
'Messages sent since May 2016 '
|
'Messages sent since May 2016 '
|
||||||
'Total messages '
|
'Total messages '
|
||||||
'1789000000 total '
|
'1.8 billion total '
|
||||||
'1,123,000,000 emails '
|
'1.1 billion emails '
|
||||||
'987,654,321 text messages '
|
'987.7 million text messages '
|
||||||
'1,234,567 letters '
|
'1.2 million letters '
|
||||||
''
|
''
|
||||||
'Date Emails Text messages Letters '
|
'Date Emails Text messages Letters '
|
||||||
'21 February 2021 1,234,567 123,456 123 '
|
'21 February 2021 1,234,567 123,456 123 '
|
||||||
|
|||||||
Reference in New Issue
Block a user