diff --git a/app/models.py b/app/models.py index 7accfc7c5..93a9bcd0c 100644 --- a/app/models.py +++ b/app/models.py @@ -1135,6 +1135,7 @@ NOTIFICATION_STATUS_TYPES_COMPLETED = [ NOTIFICATION_TEMPORARY_FAILURE, NOTIFICATION_PERMANENT_FAILURE, NOTIFICATION_RETURNED_LETTER, + NOTIFICATION_CANCELLED, ] NOTIFICATION_STATUS_SUCCESS = [ diff --git a/app/service/statistics.py b/app/service/statistics.py index 3d22b20d6..e1ed57aeb 100644 --- a/app/service/statistics.py +++ b/app/service/statistics.py @@ -86,7 +86,7 @@ def _update_statuses_from_row(update_dict, row): update_dict['delivered'] += row.count elif row.status in ( 'failed', 'technical-failure', 'temporary-failure', - 'permanent-failure', 'validation-failed', 'virus-scan-failed'): + 'permanent-failure', 'validation-failed', 'virus-scan-failed', 'cancelled'): update_dict['failed'] += row.count diff --git a/tests/app/service/test_statistics.py b/tests/app/service/test_statistics.py index 715553359..6ba357d3b 100644 --- a/tests/app/service/test_statistics.py +++ b/tests/app/service/test_statistics.py @@ -38,7 +38,8 @@ NewStatsRow = collections.namedtuple('row', ('notification_type', 'status', 'key StatsRow('letter', 'validation-failed', 1), StatsRow('letter', 'virus-scan-failed', 1), StatsRow('letter', 'permanent-failure', 1), - ], [4, 0, 4], [0, 0, 0], [3, 0, 3]), + StatsRow('letter', 'cancelled', 1), + ], [4, 0, 4], [0, 0, 0], [4, 0, 4]), 'convert_sent_to_delivered': ([ StatsRow('sms', 'sending', 1), StatsRow('sms', 'delivered', 1),