mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-13 16:52:23 -05:00
* call variables unambiguous things like `start_time` or `bst_date` to reduce risk of passing in the wrong thing * simplify the count_dict object - remove nested dict and start_date fields as superfluous * use static datetime objects in tests rather than calculating them each time
27 lines
911 B
Python
27 lines
911 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(start_time, notification_type, count):
|
|
payload = performance_platform_client.format_payload(
|
|
dataset='notifications',
|
|
start_time=start_time,
|
|
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 {
|
|
"email": email_count,
|
|
"sms": sms_count,
|
|
"letter": letter_count,
|
|
}
|