mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Show all statistics fetched on the dashboard
We want to align all our stats to be for the last 7 days. This means summing up the stats response from the API to make the Big Number. Previously the big number was counting sent notifications as successful. This commit changes it to only look at delivered notifications. Right now, the API doesn’t have a way of filtering to only show the last 7 days. So for the moment the dashboard will show statistics for all time. The upshot of this is that we can link from the dashboard to the activity page when there are failures.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
{% from "components/table.html" import list_table, field, hidden_field_heading, right_aligned_field_heading %}
|
||||
{% call(item, row_number) list_table(
|
||||
template_statistics,
|
||||
caption="In the last 7 days",
|
||||
caption="By template",
|
||||
caption_visible=False,
|
||||
empty_message='You haven’t set up any templates yet',
|
||||
field_headings=['Template', hidden_field_heading('Type'), right_aligned_field_heading('Messages sent')]
|
||||
field_headings=['Template', hidden_field_heading('Type'), right_aligned_field_heading('Messages processed')]
|
||||
) %}
|
||||
{% call field() %}
|
||||
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template.id) }}">
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
{% from "components/big-number.html" import big_number_with_status %}
|
||||
|
||||
<h2 class="heading-medium">
|
||||
Sent today
|
||||
In the last 7 days
|
||||
</h2>
|
||||
<div class="grid-row">
|
||||
<div class="grid-row bottom-gutter">
|
||||
<div class="column-half">
|
||||
{{ big_number_with_status(
|
||||
statistics.get('emails_requested', 0),
|
||||
'email' if statistics.get('emails_requested') == 1 else 'emails',
|
||||
statistics.get('emails_delivered', 0),
|
||||
'email' if statistics.get('emails_delivered') == 1 else 'emails',
|
||||
statistics.get('emails_failed'),
|
||||
statistics.get('emails_failure_rate', 0.0),
|
||||
statistics.get('emails_failure_rate', 0)|float > 3
|
||||
statistics.get('emails_failure_rate', 0)|float > 3,
|
||||
failure_link=url_for(".view_notifications", service_id=current_service.id, template_type='email', status='failed')
|
||||
) }}
|
||||
</div>
|
||||
<div class="column-half">
|
||||
@@ -19,10 +20,10 @@
|
||||
'text message' if statistics.get('sms_requested') == 1 else 'text messages',
|
||||
statistics.get('sms_failed'),
|
||||
statistics.get('sms_failure_rate', 0.0),
|
||||
statistics.get('sms_failure_rate', 0)|float > 3
|
||||
statistics.get('sms_failure_rate', 0)|float > 3,
|
||||
failure_link=url_for(".view_notifications", service_id=current_service.id, template_type='sms', status='failed')
|
||||
) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include 'views/dashboard/template-statistics.html' %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user