mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
Add filter for formatting a number as currency
This is used on the usage page, but is likely to become useful in other places now that letter rates can be greater than £1.
This commit is contained in:
@@ -456,7 +456,7 @@ def format_letter_details_for_month(letter_units_for_month):
|
||||
|
||||
letter_details = LetterDetails(
|
||||
billing_units=sum(x['billing_units'] for x in rate_group),
|
||||
rate=format_letter_rate(rate_group[0]['rate']),
|
||||
rate=rate_group[0]['rate'],
|
||||
cost=(sum(x['billing_units'] for x in rate_group) * rate_group[0]['rate']),
|
||||
postage_description=rate_group[0]['postage']
|
||||
)
|
||||
@@ -472,13 +472,6 @@ def get_postage_description(postage):
|
||||
return 'international'
|
||||
|
||||
|
||||
def format_letter_rate(number):
|
||||
if number >= 1:
|
||||
return f"£{number:,.2f}"
|
||||
|
||||
return f"{number * 100:.0f}p"
|
||||
|
||||
|
||||
def get_free_paid_breakdown_for_month(
|
||||
free_sms_fragment_limit,
|
||||
cumulative,
|
||||
|
||||
Reference in New Issue
Block a user