mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Simplify the code in the query.
The date in the notifications table should always be the most recent date for the template. Removed the template_type param for the query as well. Simplified the tests.
This commit is contained in:
@@ -58,10 +58,10 @@ def get_template_statistics_for_template_id(service_id, template_id):
|
||||
|
||||
@template_statistics.route('/last-used/<uuid:template_id>')
|
||||
def get_last_used_datetime_for_template(service_id, template_id):
|
||||
template = dao_get_template_by_id_and_service_id(template_id, service_id)
|
||||
# Check the template and service exist
|
||||
dao_get_template_by_id_and_service_id(template_id, service_id)
|
||||
|
||||
last_date_used = dao_get_last_date_template_was_used(template_id=template_id,
|
||||
template_type=template.template_type,
|
||||
service_id=service_id)
|
||||
|
||||
return jsonify(last_date_used=last_date_used.strftime(DATETIME_FORMAT))
|
||||
|
||||
Reference in New Issue
Block a user