Renamed some files and fixed a bug on deleting the failed notifications

This commit is contained in:
Martyn Inglis
2016-03-10 09:34:27 +00:00
parent c8a5366484
commit 976a4c06e3
7 changed files with 30 additions and 24 deletions

View File

@@ -89,7 +89,7 @@ def get_notifications_for_service(service_id, page=1):
def delete_successful_notifications_created_more_than_a_day_ago():
deleted = db.session.query(Notification).filter(
Notification.created_at < datetime.utcnow() - timedelta(hours=24),
Notification.created_at < datetime.utcnow() - timedelta(days=1),
Notification.status == 'sent'
).delete()
db.session.commit()
@@ -98,7 +98,7 @@ def delete_successful_notifications_created_more_than_a_day_ago():
def delete_failed_notifications_created_more_than_a_week_ago():
deleted = db.session.query(Notification).filter(
Notification.created_at < datetime.utcnow() - timedelta(hours=24 * 7),
Notification.created_at < datetime.utcnow() - timedelta(days=7),
Notification.status == 'failed'
).delete()
db.session.commit()