mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 17:01:35 -05:00
Remove all methods no longer used now that we only send pdf files to DVLA.
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user