Adding a filter to exclude test keys for the template monthly usage query.

Added a test.
This commit is contained in:
Rebecca Law
2019-01-15 16:13:38 +00:00
parent 3fdf0c7822
commit a4d89359c5
2 changed files with 20 additions and 1 deletions

View File

@@ -312,7 +312,8 @@ def fetch_monthly_template_usage_for_service(start_date, end_date, service_id):
FactNotificationStatus.service_id == service_id,
FactNotificationStatus.bst_date >= start_date,
FactNotificationStatus.bst_date <= end_date,
FactNotificationStatus.notification_status != NOTIFICATION_CANCELLED
FactNotificationStatus.key_type != KEY_TYPE_TEST,
FactNotificationStatus.notification_status != NOTIFICATION_CANCELLED,
).group_by(
FactNotificationStatus.template_id,
Template.name,