Remove all methods no longer used now that we only send pdf files to DVLA.

This commit is contained in:
Rebecca Law
2018-02-28 11:42:23 +00:00
parent 304f4d5c67
commit bffc4863db
8 changed files with 24 additions and 181 deletions

View File

@@ -28,7 +28,6 @@ from app.models import (
NotificationHistory,
ScheduledNotification,
Service,
ServicePermission,
Template,
TemplateHistory,
KEY_TYPE_NORMAL,
@@ -547,42 +546,6 @@ def dao_get_total_notifications_sent_per_day_for_performance_platform(start_date
).one()
def dao_set_created_live_letter_api_notifications_to_pending():
"""
Sets all past scheduled jobs to pending, and then returns them for further processing.
this is used in the run_scheduled_jobs task, so we put a FOR UPDATE lock on the job table for the duration of
the transaction so that if the task is run more than once concurrently, one task will block the other select
from completing until it commits.
Note - do not process services that have letters_as_pdf permission as they
will get processed when the letters PDF zip task is created
"""
notifications = db.session.query(
Notification
).join(
Service
).filter(
Notification.notification_type == LETTER_TYPE,
Notification.status == NOTIFICATION_CREATED,
Notification.key_type == KEY_TYPE_NORMAL,
Notification.api_key != None, # noqa
# Ignore services that have letters_as_pdf permission
~Service.permissions.any(
ServicePermission.permission == 'letters_as_pdf'
)
).with_for_update(
).all()
for notification in notifications:
notification.status = NOTIFICATION_PENDING
db.session.add_all(notifications)
db.session.commit()
return notifications
@statsd(namespace="dao")
def dao_get_last_notification_added_for_job_id(job_id):
last_notification_added = Notification.query.filter(