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:
Chris Hill-Scott
2016-04-19 12:57:55 +01:00
parent ddec619913
commit 5bf0d8fe70
5 changed files with 60 additions and 43 deletions

View File

@@ -6,12 +6,18 @@
{% endmacro %}
{% macro big_number_with_status(number, label, failures, failure_percentage, danger_zone=False) %}
{% macro big_number_with_status(number, label, failures, failure_percentage, danger_zone=False, failure_link=None) %}
<div class="big-number-with-status">
{{ big_number(number, label) }}
<div class="big-number-status{% if danger_zone %}-failing{% endif %}">
{% if failures %}
{{ failures }} failed {{ failure_percentage }}%
{% if failure_link %}
<a href="{{ failure_link }}">
{{ failures }} failed {{ failure_percentage }}%
</a>
{% else %}
{{ failures }} failed {{ failure_percentage }}%
{% endif %}
{% else %}
No failures
{% endif %}