mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Add scheduled task to send scheduled notifcations.
Fix the query to fetch scheduled notifications.
This commit is contained in:
@@ -473,6 +473,10 @@ def dao_created_scheduled_notification(scheduled_notification):
|
||||
|
||||
@statsd(namespace="dao")
|
||||
def dao_get_scheduled_notifications():
|
||||
scheduled_notifications = ScheduledNotification.query.filter(
|
||||
ScheduledNotification.scheduled_for < datetime.utcnow()).all()
|
||||
return scheduled_notifications
|
||||
notifications = Notification.query.join(
|
||||
ScheduledNotification
|
||||
).filter(
|
||||
ScheduledNotification.scheduled_for < datetime.utcnow(),
|
||||
Notification.status == NOTIFICATION_CREATED).all()
|
||||
|
||||
return notifications
|
||||
|
||||
Reference in New Issue
Block a user