Simplify failure rate by building separate query

This commit is contained in:
Pea Tyczynska
2019-12-03 16:18:07 +00:00
parent 53efd87e28
commit cfbb080f57
9 changed files with 77 additions and 37 deletions

View File

@@ -79,12 +79,6 @@ def test_format_statistics(stats, email_counts, sms_counts, letter_counts):
StatsRow('sms', 'permanent-failure', 100),
StatsRow('sms', 'delivered', 300),
], 0.25),
'ignores_other_notification_types': ([
StatsRow('sms', 'permanent-failure', 100),
StatsRow('sms', 'delivered', 300),
StatsRow('email', 'delivered', 300),
StatsRow('letter', 'created', 300),
], 0.25),
'only_counts_permanent_failure_as_failed': ([
StatsRow('sms', 'permanent-failure', 100),
StatsRow('sms', 'temporary-failure', 100),

View File

@@ -45,6 +45,5 @@ def test_get_services_with_high_failure_rates(notify_db_session):
assert get_services_with_high_failure_rates(start_date, end_date, threshold=3) == [{
'id': str(service_1.id),
'name': service_1.name,
'permanent_failure_rate': 0.25
}]