Limit templates usage on dashboard to last 7 days

Previous the table of templates on the dashboard was for all time.
This commit uses the `limit_days` parameter of the API endpoint to only
show template usage from the last 7 days, aligning with the big numbers
shown above.
This commit is contained in:
Chris Hill-Scott
2016-04-20 13:59:24 +01:00
parent 75214f7e54
commit 312a903e65
5 changed files with 21 additions and 16 deletions

View File

@@ -14,4 +14,4 @@ def test_template_statistics_client_calls_correct_api_endpoint(mocker, api_user_
client.get_template_statistics_for_service(some_service_id)
mock_get.assert_called_once_with(url=expected_url)
mock_get.assert_called_once_with(url=expected_url, params={})

View File

@@ -78,7 +78,7 @@ def test_should_show_recent_templates_on_dashboard(app_,
assert response.status_code == 200
response.get_data(as_text=True)
mock_get_service_statistics.assert_called_once_with(SERVICE_ONE_ID, limit_days=7)
mock_template_stats.assert_called_once_with(SERVICE_ONE_ID)
mock_template_stats.assert_called_once_with(SERVICE_ONE_ID, limit_days=7)
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
headers = [header.text.strip() for header in page.find_all('h2')]