diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index e29727536..9cbeba214 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -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'] diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index 1a47d4ced..2e48c1291 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -1106,7 +1106,8 @@ def test_usage_page_displays_letters_ordered_by_postage( 'month': 'April', 'notification_type': 'letter', 'rate': 0.5, - 'billing_units': 1, + 'chargeable_units': 1, + 'notifications_sent': 1, 'postage': 'second', 'letter_cost': 0.5, }, @@ -1114,7 +1115,8 @@ def test_usage_page_displays_letters_ordered_by_postage( 'month': 'April', 'notification_type': 'letter', 'rate': 1, - 'billing_units': 1, + 'chargeable_units': 1, + 'notifications_sent': 1, 'postage': 'europe', 'letter_cost': 1, }, @@ -1122,7 +1124,8 @@ def test_usage_page_displays_letters_ordered_by_postage( 'month': 'April', 'notification_type': 'letter', 'rate': 1, - 'billing_units': 2, + 'chargeable_units': 2, + 'notifications_sent': 2, 'postage': 'rest-of-word', 'letter_cost': 2, }, @@ -1130,7 +1133,8 @@ def test_usage_page_displays_letters_ordered_by_postage( 'month': 'April', 'notification_type': 'letter', 'rate': 1.5, - 'billing_units': 7, + 'chargeable_units': 7, + 'notifications_sent': 7, 'postage': 'europe', 'letter_cost': 11.5, }, @@ -1138,7 +1142,8 @@ def test_usage_page_displays_letters_ordered_by_postage( 'month': 'April', 'notification_type': 'letter', 'rate': 0.3, - 'billing_units': 3, + 'chargeable_units': 3, + 'notifications_sent': 3, 'postage': 'second', 'letter_cost': 0.9, }, @@ -1146,7 +1151,8 @@ def test_usage_page_displays_letters_ordered_by_postage( 'month': 'April', 'notification_type': 'letter', 'rate': 0.5, - 'billing_units': 1, + 'chargeable_units': 1, + 'notifications_sent': 1, 'postage': 'first', 'letter_cost': 0.5, }, @@ -1183,7 +1189,8 @@ def test_usage_page_displays_letters_split_by_month_and_postage( 'month': 'April', 'notification_type': 'letter', 'rate': 0.5, - 'billing_units': 1, + 'chargeable_units': 1, + 'notifications_sent': 1, 'postage': 'second', 'letter_cost': 0.5, }, @@ -1191,7 +1198,8 @@ def test_usage_page_displays_letters_split_by_month_and_postage( 'month': 'April', 'notification_type': 'letter', 'rate': 1, - 'billing_units': 1, + 'chargeable_units': 1, + 'notifications_sent': 1, 'postage': 'europe', 'letter_cost': 1, }, @@ -1199,7 +1207,8 @@ def test_usage_page_displays_letters_split_by_month_and_postage( 'month': 'May', 'notification_type': 'letter', 'rate': 1, - 'billing_units': 7, + 'chargeable_units': 7, + 'notifications_sent': 7, 'postage': 'europe', 'letter_cost': 7, }, @@ -1207,7 +1216,8 @@ def test_usage_page_displays_letters_split_by_month_and_postage( 'month': 'May', 'notification_type': 'letter', 'rate': 0.5, - 'billing_units': 3, + 'chargeable_units': 3, + 'notifications_sent': 3, 'postage': 'second', 'letter_cost': 1.5, }, @@ -1215,7 +1225,8 @@ def test_usage_page_displays_letters_split_by_month_and_postage( 'month': 'May', 'notification_type': 'letter', 'rate': 0.7, - 'billing_units': 1, + 'chargeable_units': 1, + 'notifications_sent': 1, 'postage': 'first', 'letter_cost': 0.7, }, @@ -1665,7 +1676,8 @@ def test_get_monthly_usage_breakdown(now, expected_number_of_months): 'rate_multiplier': 1, 'notification_type': 'sms', 'rate': 1.65, - 'billing_units': 100000, + 'chargeable_units': 100000, + 'notifications_sent': 1234, 'sms_charged': 0, 'sms_free_allowance_used': 100000, 'sms_cost': 0, @@ -1676,7 +1688,8 @@ def test_get_monthly_usage_breakdown(now, expected_number_of_months): 'rate_multiplier': 1, 'notification_type': 'sms', 'rate': 1.65, - 'billing_units': 100000, + 'chargeable_units': 100000, + 'notifications_sent': 1234, 'sms_charged': 0, 'sms_free_allowance_used': 100000, 'sms_cost': 0, @@ -1687,7 +1700,8 @@ def test_get_monthly_usage_breakdown(now, expected_number_of_months): 'rate_multiplier': 1, 'notification_type': 'sms', 'rate': 1.71, - 'billing_units': 100000, + 'chargeable_units': 100000, + 'notifications_sent': 1234, 'sms_charged': 50000, 'sms_free_allowance_used': 50000, 'sms_cost': 85500, @@ -1698,7 +1712,8 @@ def test_get_monthly_usage_breakdown(now, expected_number_of_months): 'rate_multiplier': 1, 'notification_type': 'sms', 'rate': 1.71, - 'billing_units': 2000, + 'chargeable_units': 2000, + 'notifications_sent': 1234, 'sms_charged': 2000, 'sms_free_allowance_used': 0, 'sms_cost': 3420, diff --git a/tests/conftest.py b/tests/conftest.py index 388805cc5..1ae650b5a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2362,7 +2362,8 @@ def mock_get_monthly_usage_for_service(mocker): 'month': 'March', 'notification_type': 'sms', 'rate': 0.017, - 'billing_units': 1230, + 'chargeable_units': 1230, + 'notifications_sent': 1234, 'postage': 'none', 'sms_charged': 1230, 'sms_free_allowance_used': 0, @@ -2373,7 +2374,8 @@ def mock_get_monthly_usage_for_service(mocker): 'month': 'February', 'notification_type': 'sms', 'rate': 0.0165, - 'billing_units': 1100, + 'chargeable_units': 1100, + 'notifications_sent': 1234, 'postage': 'none', 'sms_charged': 960, 'sms_free_allowance_used': 140, @@ -2384,7 +2386,8 @@ def mock_get_monthly_usage_for_service(mocker): 'month': 'February', 'notification_type': 'letter', 'rate': 0.31, - 'billing_units': 10, + 'chargeable_units': 10, + 'notifications_sent': 10, 'postage': 'second', 'sms_charged': 0, 'sms_free_allowance_used': 0, @@ -2395,7 +2398,8 @@ def mock_get_monthly_usage_for_service(mocker): 'month': 'February', 'notification_type': 'letter', 'rate': 0.33, - 'billing_units': 5, + 'chargeable_units': 5, + 'notifications_sent': 5, 'postage': 'first', 'sms_charged': 0, 'sms_free_allowance_used': 0, @@ -2406,7 +2410,8 @@ def mock_get_monthly_usage_for_service(mocker): 'month': 'February', 'notification_type': 'letter', 'rate': 0.84, - 'billing_units': 3, + 'chargeable_units': 3, + 'notifications_sent': 3, 'postage': 'europe', 'sms_charged': 0, 'sms_free_allowance_used': 0, @@ -2417,7 +2422,8 @@ def mock_get_monthly_usage_for_service(mocker): 'month': 'February', 'notification_type': 'letter', 'rate': 0.84, - 'billing_units': 7, + 'chargeable_units': 7, + 'notifications_sent': 7, 'postage': 'rest-of-world', 'sms_charged': 0, 'sms_free_allowance_used': 0, @@ -2428,7 +2434,8 @@ def mock_get_monthly_usage_for_service(mocker): 'month': 'April', 'notification_type': 'sms', 'rate': 0.017, - 'billing_units': 249860, + 'chargeable_units': 249860, + 'notifications_sent': 1234, 'postage': 'none', 'sms_charged': 0, 'sms_free_allowance_used': 249860,