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 prioriry list.

This PR removes the code for scheduled_for. There will be another PR to drop the scheduled_notifications table.

Unforetunately, 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-11 17:31:26 +01:00
parent 4d2396699a
commit 003ae7521b
10 changed files with 20 additions and 153 deletions

View File

@@ -27,7 +27,7 @@ from notifications_utils.template import (
SMSMessageTemplate,
LetterPrintTemplate,
)
from notifications_utils.timezones import convert_bst_to_utc, convert_utc_to_bst
from notifications_utils.timezones import convert_utc_to_bst
from app.hashing import (
hashpw,
@@ -291,7 +291,6 @@ service_letter_branding = db.Table(
INTERNATIONAL_SMS_TYPE = 'international_sms'
INBOUND_SMS_TYPE = 'inbound_sms'
SCHEDULE_NOTIFICATIONS = 'schedule_notifications'
EMAIL_AUTH = 'email_auth'
LETTERS_AS_PDF = 'letters_as_pdf'
PRECOMPILED_LETTER = 'precompiled_letter'
@@ -306,7 +305,6 @@ SERVICE_PERMISSION_TYPES = [
LETTER_TYPE,
INTERNATIONAL_SMS_TYPE,
INBOUND_SMS_TYPE,
SCHEDULE_NOTIFICATIONS,
EMAIL_AUTH,
LETTERS_AS_PDF,
UPLOAD_DOCUMENT,
@@ -1415,8 +1413,6 @@ class Notification(db.Model):
client_reference = db.Column(db.String, index=True, nullable=True)
_personalisation = db.Column(db.String, nullable=True)
scheduled_notification = db.relationship('ScheduledNotification', uselist=False)
client_reference = db.Column(db.String, index=True, nullable=True)
international = db.Column(db.Boolean, nullable=False, default=False)
@@ -1632,13 +1628,7 @@ class Notification(db.Model):
"created_by_name": self.get_created_by_name(),
"sent_at": self.sent_at.strftime(DATETIME_FORMAT) if self.sent_at else None,
"completed_at": self.completed_at(),
"scheduled_for": (
convert_bst_to_utc(
self.scheduled_notification.scheduled_for
).strftime(DATETIME_FORMAT)
if self.scheduled_notification
else None
),
"scheduled_for": None,
"postage": self.postage
}