From 8106d6fdf26ae263296c7a2737029be70849a47d Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 11 Mar 2021 13:11:39 +0000 Subject: [PATCH] Limit data to last 7 days Otherwise the page gets really long. Also matches what we have on our dashboards by default. --- app/main/views/performance.py | 2 +- app/templates/views/performance.html | 6 ++++++ tests/app/main/views/test_performance.py | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/main/views/performance.py b/app/main/views/performance.py index 14e8e3d65..e8d0eef0d 100644 --- a/app/main/views/performance.py +++ b/app/main/views/performance.py @@ -12,7 +12,7 @@ from app.main import main @main.route("/performance") def performance(): stats = performance_dashboard_api_client.get_performance_dashboard_stats( - start_date=(datetime.utcnow() - timedelta(days=90)).date(), + start_date=(datetime.utcnow() - timedelta(days=7)).date(), end_date=datetime.utcnow().date(), ) stats['organisations_using_notify'] = sorted( diff --git a/app/templates/views/performance.html b/app/templates/views/performance.html index 05235134c..609ce9de4 100644 --- a/app/templates/views/performance.html +++ b/app/templates/views/performance.html @@ -77,6 +77,9 @@ {{ item.letters|format_thousands }} {% endcall %} {% endcall %} +

@@ -107,6 +110,9 @@ {{ item.percentage_under_10_seconds }}% {% endcall %} {% endcall %} +

diff --git a/tests/app/main/views/test_performance.py b/tests/app/main/views/test_performance.py index 6709d8b73..a48153aef 100644 --- a/tests/app/main/views/test_performance.py +++ b/tests/app/main/views/test_performance.py @@ -109,7 +109,7 @@ def test_should_render_performance_page( ) page = client_request.get('main.performance') mock_get_performance_data.assert_called_once_with( - start_date=date(2020, 10, 3), + start_date=date(2020, 12, 25), end_date=date(2021, 1, 1), ) assert normalize_spaces(page.select_one('main').text) == ( @@ -130,6 +130,7 @@ def test_should_render_performance_page( '25 February 2021 1 2 3 ' '26 February 2021 1 2 3 ' '27 February 2021 1 2 3 ' + 'Only showing the last 7 days ' '' 'Messages sent within 10 seconds ' 'Average ' @@ -142,6 +143,7 @@ def test_should_render_performance_page( '23 February 2021 95.6% ' '22 February 2021 95.3% ' '21 February 2021 99.2% ' + 'Only showing the last 7 days ' '' 'Organisations using Notify ' 'Organisation Number of live services '