mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-18 05:28:49 -04:00
Fix bug in organisation report for its services and usages.
If a service has not sent any SMS for the financial year the free allowance was showing up as 0 rather than the number in annual billing. The query has been updated to use an outer join so that the free allow will be returned when there is no ft_billing. There is a potential performance enhancement to only return the data for the services of the organisation in the `fetch_sms_free_allowance_remainder_until_date` subquery. I will investigate in a subsequent PR.
This commit is contained in:
@@ -1054,6 +1054,19 @@ def set_up_usage_data(start_date):
|
||||
)
|
||||
create_ft_billing(bst_date=one_week_later, template=sms_template_2, billable_unit=2, rate=0.11)
|
||||
|
||||
# service without ft_billing this year
|
||||
service_with_out_ft_billing_this_year = create_service(
|
||||
service_name='f - without ft_billing',
|
||||
purchase_order_number="sms purchase order number",
|
||||
billing_contact_names="sms billing contact names",
|
||||
billing_contact_email_addresses="sms@billing.contact email@addresses.gov.uk",
|
||||
billing_reference="sms billing reference"
|
||||
)
|
||||
create_annual_billing(
|
||||
service_id=service_with_out_ft_billing_this_year.id, free_sms_fragment_limit=10, financial_year_start=year
|
||||
)
|
||||
dao_add_service_to_organisation(service=service_with_out_ft_billing_this_year, organisation_id=org_1.id)
|
||||
|
||||
# dictionary with services and orgs to return
|
||||
return {
|
||||
"org_1": org_1,
|
||||
@@ -1065,6 +1078,7 @@ def set_up_usage_data(start_date):
|
||||
"service_with_letters_without_org": service_with_letters_without_org,
|
||||
"service_with_sms_without_org": service_with_sms_without_org,
|
||||
"service_with_sms_within_allowance": service_with_sms_within_allowance,
|
||||
"service_with_out_ft_billing_this_year": service_with_out_ft_billing_this_year,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user