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

@@ -83,9 +83,9 @@ def test_should_show_recent_templates_on_dashboard(app_,
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
headers = [header.text.strip() for header in page.find_all('h2')]
assert 'Test Service' in headers
assert 'Sent today' in headers
assert 'In the last 7 days' in headers
template_usage_headers = [th.text.strip() for th in page.thead.find_all('th')]
for th in ['Template', 'Type', 'Messages sent']:
for th in ['Template', 'Type', 'Messages processed']:
assert th in template_usage_headers
table_rows = page.tbody.find_all('tr')