Finish migration from billing_units to API fields

This is now only used for letters and represents the number sent
[^1].  We could use the chargeable_units field, but using "_sent"
is more consistent with the annual attributes [^2].

In fact, chargeable_units isn't actually used anywhere, but I've
kept it in the test data as it is part of the real API and helps
clarify the other values for SMS - free vs. charged.

Note: for SMS I've used an arbitrary "1234" for "chargeable_units"
to indicate it's not used and may be different to the number sent -
for SMS it's related to the number of fragments.

[^1]: bb62d22f25/app/dao/fact_billing_dao.py (L339)
[^2]: 3a1ac189ff/app/main/views/dashboard.py (L339)
This commit is contained in:
Ben Thorner
2022-05-03 10:33:04 +01:00
parent c0ee24ff19
commit fb7c116046
3 changed files with 45 additions and 23 deletions

View File

@@ -442,7 +442,7 @@ def format_letter_details_for_month(letter_units_for_month):
rate_group = list(rate_group)
letter_details = LetterDetails(
sent=sum(x['billing_units'] for x in rate_group),
sent=sum(x['notifications_sent'] for x in rate_group),
rate=rate_group[0]['rate'],
cost=sum(x['letter_cost'] for x in rate_group),
postage_description=rate_group[0]['postage']