2017-08-23 15:04:37 +01:00
|
|
|
from app import performance_platform_client
|
2019-03-29 14:21:05 +00:00
|
|
|
from app.dao.fact_notification_status_dao import get_total_sent_notifications_for_day_and_type
|
2017-08-23 15:04:37 +01:00
|
|
|
|
|
|
|
|
|
2019-04-02 11:49:20 +01:00
|
|
|
def send_total_notifications_sent_for_day_stats(start_time, notification_type, count):
|
2017-08-24 17:08:39 +01:00
|
|
|
payload = performance_platform_client.format_payload(
|
2017-08-23 15:04:37 +01:00
|
|
|
dataset='notifications',
|
2019-04-02 11:49:20 +01:00
|
|
|
start_time=start_time,
|
2017-08-24 17:08:39 +01:00
|
|
|
group_name='channel',
|
|
|
|
|
group_value=notification_type,
|
|
|
|
|
count=count
|
2017-08-23 15:04:37 +01:00
|
|
|
)
|
|
|
|
|
|
2017-08-24 17:08:39 +01:00
|
|
|
performance_platform_client.send_stats_to_performance_platform(payload)
|
|
|
|
|
|
2017-08-24 10:52:47 +01:00
|
|
|
|
2018-03-05 16:44:20 +00:00
|
|
|
def get_total_sent_notifications_for_day(day):
|
2019-03-29 14:21:05 +00:00
|
|
|
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')
|
2017-08-23 15:04:37 +01:00
|
|
|
|
|
|
|
|
return {
|
2019-04-02 11:49:20 +01:00
|
|
|
"email": email_count,
|
|
|
|
|
"sms": sms_count,
|
|
|
|
|
"letter": letter_count,
|
2017-08-23 15:04:37 +01:00
|
|
|
}
|