mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-15 07:18:58 -04:00
Show sent, not pending numbers on the dashboard
The dashboard should only talk about notifications that are *successful* or *failed*. It should not count notifications that are still queued. This will stop: - a situation like ‘0 emails, 14.1% failed’ - the big numbers and the template statistics numbers not adding up to the same total
This commit is contained in:
@@ -99,14 +99,19 @@ def add_rates_to(delivery_statistics):
|
||||
delivery_statistics
|
||||
)
|
||||
|
||||
sum_of_statistics.update({
|
||||
'emails_sent': sum_of_statistics['emails_failed'] + sum_of_statistics['emails_delivered'],
|
||||
'sms_sent': sum_of_statistics['sms_failed'] + sum_of_statistics['sms_delivered']
|
||||
})
|
||||
|
||||
return dict(
|
||||
emails_failure_rate=(
|
||||
"{0:.1f}".format((float(sum_of_statistics['emails_failed']) / sum_of_statistics['emails_requested'] * 100))
|
||||
if sum_of_statistics.get('emails_requested') else 0
|
||||
"{0:.1f}".format((float(sum_of_statistics['emails_failed']) / sum_of_statistics['emails_sent'] * 100))
|
||||
if sum_of_statistics.get('emails_sent') else 0
|
||||
),
|
||||
sms_failure_rate=(
|
||||
"{0:.1f}".format((float(sum_of_statistics['sms_failed']) / sum_of_statistics['sms_requested'] * 100))
|
||||
if sum_of_statistics.get('sms_requested') else 0
|
||||
"{0:.1f}".format((float(sum_of_statistics['sms_failed']) / sum_of_statistics['sms_sent'] * 100))
|
||||
if sum_of_statistics.get('sms_sent') else 0
|
||||
),
|
||||
**sum_of_statistics
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user