mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 17:01:35 -05:00
Merge pull request #1734 from alphagov/count-letters-performance-platform
Send count of sent letters to performance platform
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user