Include pending notifications in monthly data by service report

The '/service/monthly-data-by-service` endpoint which is used for the
'Monthly notification statuses for live services' Platform Admin report
did not including `pending` notifications. This updates the DAO function
that the endpoint calls to group `pending` and `sending` notifications together.
This commit is contained in:
Katie Smith
2020-04-30 13:53:01 +01:00
parent 1d3f9589ea
commit 5b8b0dfc6e
2 changed files with 6 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ from app.models import (
NOTIFICATION_CREATED,
NOTIFICATION_DELIVERED,
NOTIFICATION_FAILED,
NOTIFICATION_PENDING,
NOTIFICATION_SENDING,
NOTIFICATION_SENT,
NOTIFICATION_TECHNICAL_FAILURE,
@@ -462,7 +463,7 @@ def fetch_monthly_notification_statuses_per_service(start_date, end_date):
FactNotificationStatus.notification_type,
func.sum(case(
[
(FactNotificationStatus.notification_status == NOTIFICATION_SENDING,
(FactNotificationStatus.notification_status.in_([NOTIFICATION_SENDING, NOTIFICATION_PENDING]),
FactNotificationStatus.notification_count)
],
else_=0)).label('count_sending'),