mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 07:51:13 -05:00
Merge pull request #2254 from alphagov/improve-performance-of-get-notifications-for-service
Remove the join to TemplateHistory.
This commit is contained in:
@@ -32,7 +32,6 @@ from app.models import (
|
|||||||
NotificationHistory,
|
NotificationHistory,
|
||||||
ScheduledNotification,
|
ScheduledNotification,
|
||||||
Template,
|
Template,
|
||||||
TemplateHistory,
|
|
||||||
KEY_TYPE_TEST,
|
KEY_TYPE_TEST,
|
||||||
LETTER_TYPE,
|
LETTER_TYPE,
|
||||||
NOTIFICATION_CREATED,
|
NOTIFICATION_CREATED,
|
||||||
@@ -312,7 +311,7 @@ def _filter_query(query, filter_dict=None):
|
|||||||
# filter by template
|
# filter by template
|
||||||
template_types = multidict.getlist('template_type')
|
template_types = multidict.getlist('template_type')
|
||||||
if template_types:
|
if template_types:
|
||||||
query = query.join(TemplateHistory).filter(TemplateHistory.template_type.in_(template_types))
|
query = query.filter(Notification.notification_type.in_(template_types))
|
||||||
|
|
||||||
return query
|
return query
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user