Remove unused methods.

A new endpoint to return the last date a template was used which means the old endpoint can be removed.
This commit is contained in:
Rebecca Law
2020-02-07 15:50:54 +00:00
parent 9cd433349c
commit 8445775be0
5 changed files with 4 additions and 143 deletions

View File

@@ -56,21 +56,6 @@ from app.utils import get_london_midnight_in_utc
from app.utils import midnight_n_days_ago, escape_special_characters
@statsd(namespace="dao")
def dao_get_last_template_usage(template_id, template_type, service_id):
# By adding the service_id to the filter the performance of the query is greatly improved.
# Using a max(Notification.created_at) is better than order by and limit one.
# But the effort to change the endpoint to return a datetime only is more than the gain.
return Notification.query.filter(
Notification.template_id == template_id,
Notification.key_type != KEY_TYPE_TEST,
Notification.notification_type == template_type,
Notification.service_id == service_id
).order_by(
desc(Notification.created_at)
).first()
@statsd(namespace="dao")
def dao_get_last_date_template_was_used(template_id, service_id):
last_date_from_notifications = db.session.query(