mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-23 15:56:45 -04:00
split out org sms usage into separate function
this'll allow us to reuse the complex sql query for the platform admin report, which doesn't care about organisations
This commit is contained in:
@@ -762,6 +762,12 @@ def fetch_sms_billing_for_organisation(organisation_id, financial_year):
|
||||
|
||||
|
||||
def query_organisation_sms_usage_for_year(organisation_id, year):
|
||||
return query_sms_usage_for_year_per_service(year).filter(
|
||||
Service.organisation_id == organisation_id
|
||||
)
|
||||
|
||||
|
||||
def query_sms_usage_for_year_per_service(year):
|
||||
"""
|
||||
See docstring for query_service_sms_usage_for_year()
|
||||
"""
|
||||
@@ -813,7 +819,6 @@ def query_organisation_sms_usage_for_year(organisation_id, year):
|
||||
FactBilling.notification_type == SMS_TYPE,
|
||||
)
|
||||
).filter(
|
||||
Service.organisation_id == organisation_id,
|
||||
AnnualBilling.financial_year_start == year,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user