Files
notifications-api/app/performance_platform/total_sent_notifications.py
Rebecca Law 1806f092f3 Update the nightly task that send performance platform statistics to use ft_notification_status rather than notification_history.
The previous query was including all notifications regardless of notification_status. I don't think that's right, it shouldn't include things like technical-failure or validation-failed. Thoughts?

I also need to remove the query that's no longer being used.
2019-03-29 14:21:05 +00:00

34 lines
1019 B
Python

from app import performance_platform_client
from app.dao.fact_notification_status_dao import get_total_sent_notifications_for_day_and_type
def send_total_notifications_sent_for_day_stats(date, notification_type, count):
payload = performance_platform_client.format_payload(
dataset='notifications',
date=date,
group_name='channel',
group_value=notification_type,
count=count
)
performance_platform_client.send_stats_to_performance_platform(payload)
def get_total_sent_notifications_for_day(day):
email_count = get_total_sent_notifications_for_day_and_type(day, 'email')
sms_count = get_total_sent_notifications_for_day_and_type(day, 'sms')
letter_count = get_total_sent_notifications_for_day_and_type(day, 'letter')
return {
"start_date": day,
"email": {
"count": email_count
},
"sms": {
"count": sms_count
},
"letter": {
"count": letter_count
},
}