mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
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.
This commit is contained in:
@@ -394,3 +394,15 @@ def fetch_monthly_template_usage_for_service(start_date, end_date, service_id):
|
||||
else:
|
||||
query = stats
|
||||
return query.all()
|
||||
|
||||
|
||||
def get_total_sent_notifications_for_day_and_type(day, notification_type):
|
||||
result = db.session.query(
|
||||
func.sum(FactNotificationStatus.notification_count).label('count')
|
||||
).filter(
|
||||
FactNotificationStatus.notification_type == notification_type,
|
||||
FactNotificationStatus.key_type != KEY_TYPE_TEST,
|
||||
FactNotificationStatus.bst_date == day,
|
||||
).scalar()
|
||||
|
||||
return result or 0
|
||||
|
||||
Reference in New Issue
Block a user