Put counts into the notification filters

We can filter notifications on the activity page by state.

This commit adds counts to those filters.

This is mainly so that we can consistently do the same thing on the job
page later on.
This commit is contained in:
Chris Hill-Scott
2016-06-08 15:15:59 +01:00
parent e5d2514846
commit e7e0b2f227
6 changed files with 80 additions and 19 deletions

View File

@@ -48,3 +48,24 @@ def add_rates_to(delivery_statistics):
),
**delivery_statistics
)
def statistics_by_state(statistics):
return {
'sms': {
'processed': statistics['sms_requested'],
'sending': (
statistics['sms_requested'] - statistics['sms_failed'] - statistics['sms_delivered']
),
'delivered': statistics['sms_delivered'],
'failed': statistics['sms_failed']
},
'email': {
'processed': statistics['emails_requested'],
'sending': (
statistics['emails_requested'] - statistics['emails_failed'] - statistics['emails_delivered']
),
'delivered': statistics['emails_delivered'],
'failed': statistics['emails_failed']
}
}