Remove the use of schedule_for in post_notifications.

Years ago we started to implement a way to schedule a notification. We hit a problem but we never came up with a good solution and the feature never made it back to the top of the priority list.

This PR removes the code for scheduled_for. There will be another PR to drop the scheduled_notifications table and remove the schedule_notifications service permission

Unfortunately, I don't think we can remove the `scheduled_for` attribute from the notification.serialized method because out clients might fail if something is missing. For now I have left it in but defaulted the value to None.
This commit is contained in:
Rebecca Law
2020-06-24 07:34:58 +01:00
parent d108c644bc
commit ce32e577b7
12 changed files with 34 additions and 178 deletions

View File

@@ -14,7 +14,6 @@ from notifications_utils.template import (
SMSMessageTemplate,
LetterPrintTemplate,
)
from notifications_utils.timezones import convert_bst_to_utc
from app import redis_store
from app.celery import provider_tasks
@@ -28,12 +27,10 @@ from app.models import (
LETTER_TYPE,
NOTIFICATION_CREATED,
Notification,
ScheduledNotification
)
from app.dao.notifications_dao import (
dao_create_notification,
dao_delete_notifications_by_id,
dao_created_scheduled_notification
)
from app.v2.errors import BadRequestError
@@ -217,10 +214,3 @@ def simulated_recipient(to_address, notification_type):
return to_address in formatted_simulated_numbers
else:
return to_address in current_app.config['SIMULATED_EMAIL_ADDRESSES']
def persist_scheduled_notification(notification_id, scheduled_for):
scheduled_datetime = convert_bst_to_utc(datetime.strptime(scheduled_for, "%Y-%m-%d %H:%M"))
scheduled_notification = ScheduledNotification(notification_id=notification_id,
scheduled_for=scheduled_datetime)
dao_created_scheduled_notification(scheduled_notification)