diff --git a/app/celery/scheduled_tasks.py b/app/celery/scheduled_tasks.py index 9d5249e8a..7500111a7 100644 --- a/app/celery/scheduled_tasks.py +++ b/app/celery/scheduled_tasks.py @@ -221,6 +221,7 @@ def send_total_sent_notifications_to_performance_platform(): count_dict = total_sent_notifications.get_total_sent_notifications_yesterday() email_sent_count = count_dict.get('email').get('count') sms_sent_count = count_dict.get('sms').get('count') + letter_sent_count = count_dict.get('letter').get('count') start_date = count_dict.get('start_date') current_app.logger.info( @@ -240,6 +241,12 @@ def send_total_sent_notifications_to_performance_platform(): email_sent_count ) + total_sent_notifications.send_total_notifications_sent_for_day_stats( + start_date, + 'letter', + letter_sent_count + ) + @notify_celery.task(name='switch-current-sms-provider-on-slow-delivery') @statsd(namespace="tasks") diff --git a/app/performance_platform/total_sent_notifications.py b/app/performance_platform/total_sent_notifications.py index 4ad57171e..4aa62c786 100644 --- a/app/performance_platform/total_sent_notifications.py +++ b/app/performance_platform/total_sent_notifications.py @@ -27,6 +27,7 @@ def get_total_sent_notifications_yesterday(): email_count = get_total_sent_notifications_in_date_range(start_date, end_date, 'email') sms_count = get_total_sent_notifications_in_date_range(start_date, end_date, 'sms') + letter_count = get_total_sent_notifications_in_date_range(start_date, end_date, 'letter') return { "start_date": start_date, @@ -35,5 +36,8 @@ def get_total_sent_notifications_yesterday(): }, "sms": { "count": sms_count - } + }, + "letter": { + "count": letter_count + }, } diff --git a/tests/app/performance_platform/test_total_sent_notifications.py b/tests/app/performance_platform/test_total_sent_notifications.py index e4fe597d0..2ad2a93f6 100644 --- a/tests/app/performance_platform/test_total_sent_notifications.py +++ b/tests/app/performance_platform/test_total_sent_notifications.py @@ -56,6 +56,7 @@ def test_get_total_sent_notifications_yesterday_returns_expected_totals_dict( # Create some notifications for the day before yesterday = datetime(2016, 1, 10, 15, 30, 0, 0) with freeze_time(yesterday): + notification_history(notification_type='letter') notification_history(notification_type='sms') notification_history(notification_type='sms') notification_history(notification_type='email') @@ -71,5 +72,8 @@ def test_get_total_sent_notifications_yesterday_returns_expected_totals_dict( }, "sms": { "count": 2 + }, + "letter": { + "count": 1 } }