2017-08-23 15:04:37 +01:00
|
|
|
from app import performance_platform_client
|
2021-03-10 13:55:06 +00:00
|
|
|
from app.dao.fact_notification_status_dao import (
|
|
|
|
|
get_total_sent_notifications_for_day_and_type,
|
|
|
|
|
)
|
2024-01-10 12:32:25 -05:00
|
|
|
from app.enums import NotificationType
|
2017-08-23 15:04:37 +01:00
|
|
|
|
|
|
|
|
|
2023-03-02 20:20:31 -05:00
|
|
|
# TODO: is this obsolete? it doesn't seem to be used anywhere
|
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(
|
2023-08-29 14:54:30 -07:00
|
|
|
dataset="notifications",
|
2019-04-02 11:49:20 +01:00
|
|
|
start_time=start_time,
|
2023-08-29 14:54:30 -07:00
|
|
|
group_name="channel",
|
2017-08-24 17:08:39 +01:00
|
|
|
group_value=notification_type,
|
2023-08-29 14:54:30 -07:00
|
|
|
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
|
|
|
|
2023-03-02 20:20:31 -05:00
|
|
|
# TODO: is this obsolete? it doesn't seem to be used anywhere
|
2018-03-05 16:44:20 +00:00
|
|
|
def get_total_sent_notifications_for_day(day):
|
2024-01-10 12:32:25 -05:00
|
|
|
email_count = get_total_sent_notifications_for_day_and_type(
|
|
|
|
|
day, NotificationType.EMAIL
|
|
|
|
|
)
|
2024-01-10 11:18:33 -05:00
|
|
|
sms_count = get_total_sent_notifications_for_day_and_type(day, NotificationType.SMS)
|
2017-08-23 15:04:37 +01:00
|
|
|
|
|
|
|
|
return {
|
2024-02-20 17:05:34 -05:00
|
|
|
NotificationType.EMAIL: email_count,
|
|
|
|
|
NotificationType.SMS: sms_count,
|
2017-08-23 15:04:37 +01:00
|
|
|
}
|