mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Fix bug on organisation-usage page.
The dict is initialised for all live services, but if the organisation has trial mode services they cause a key error.
This commit is contained in:
@@ -554,7 +554,8 @@ def fetch_letter_costs_for_organisation(organisation_id, start_date, end_date):
|
||||
FactBilling.bst_date >= start_date,
|
||||
FactBilling.bst_date <= end_date,
|
||||
FactBilling.notification_type == LETTER_TYPE,
|
||||
Service.organisation_id == organisation_id
|
||||
Service.organisation_id == organisation_id,
|
||||
Service.restricted.is_(False)
|
||||
).group_by(
|
||||
Service.id,
|
||||
Service.name,
|
||||
@@ -579,7 +580,8 @@ def fetch_email_usage_for_organisation(organisation_id, start_date, end_date):
|
||||
FactBilling.bst_date >= start_date,
|
||||
FactBilling.bst_date <= end_date,
|
||||
FactBilling.notification_type == EMAIL_TYPE,
|
||||
Service.organisation_id == organisation_id
|
||||
Service.organisation_id == organisation_id,
|
||||
Service.restricted.is_(False)
|
||||
).group_by(
|
||||
Service.id,
|
||||
Service.name,
|
||||
@@ -621,7 +623,8 @@ def fetch_sms_billing_for_organisation(organisation_id, start_date, end_date):
|
||||
FactBilling.bst_date >= start_date,
|
||||
FactBilling.bst_date <= end_date,
|
||||
FactBilling.notification_type == SMS_TYPE,
|
||||
Service.organisation_id == organisation_id
|
||||
Service.organisation_id == organisation_id,
|
||||
Service.restricted.is_(False)
|
||||
).group_by(
|
||||
Service.id,
|
||||
Service.name,
|
||||
|
||||
@@ -71,7 +71,7 @@ def persist_notification(
|
||||
billable_units=None,
|
||||
postage=None,
|
||||
template_postage=None,
|
||||
document_download_count=None,
|
||||
document_download_count=None
|
||||
):
|
||||
notification_created_at = created_at or datetime.utcnow()
|
||||
if not notification_id:
|
||||
|
||||
Reference in New Issue
Block a user