Add scheduled task to send scheduled notifcations.

Fix the query to fetch scheduled notifications.
This commit is contained in:
Rebecca Law
2017-05-16 13:47:22 +01:00
parent 56f657de9b
commit 2e078f9fc8
5 changed files with 55 additions and 11 deletions

View File

@@ -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