Exclude test key notifications from:

- get all notifications by service
- template usage
- most recently used templates

Ensures that the dashboard shows no test key data. Supplements: https://github.com/alphagov/notifications-api/pull/677 which excludes CSV data. This branches from that so is dependant.
This commit is contained in:
Martyn Inglis
2016-09-16 13:47:09 +01:00
parent d4971cc45f
commit 7c16294b75
4 changed files with 132 additions and 9 deletions

View File

@@ -23,8 +23,8 @@ from app.models import (
Permission,
User,
InvitedUser,
Service
)
Service,
KEY_TYPE_TEST)
from app.statsd_decorators import statsd
@@ -156,7 +156,8 @@ def _stats_for_service_query(service_id):
Notification.status,
func.count(Notification.id).label('count')
).filter(
Notification.service_id == service_id
Notification.service_id == service_id,
Notification.key_type != KEY_TYPE_TEST
).group_by(
Notification.notification_type,
Notification.status,