Limit number of navigable financial years to 3

Because more than 3 looks ugly.
This commit is contained in:
Chris Hill-Scott
2018-04-03 18:13:38 +01:00
parent 146bb3284e
commit d75f89daf5
2 changed files with 25 additions and 0 deletions

View File

@@ -130,6 +130,7 @@ def template_usage(service_id):
),
years=get_tuples_of_financial_years(
partial(url_for, '.template_usage', service_id=service_id),
start=current_financial_year - 2,
end=current_financial_year,
),
selected_year=year
@@ -179,6 +180,7 @@ def monthly(service_id):
),
years=get_tuples_of_financial_years(
partial_url=partial(url_for, '.monthly', service_id=service_id),
start=current_financial_year - 2,
end=current_financial_year,
),
selected_year=year,

View File

@@ -472,6 +472,29 @@ def test_monthly_shows_letters_in_breakdown(
assert normalize_spaces(columns[2].text) == 'letters'
@pytest.mark.parametrize('endpoint', [
'main.monthly',
'main.template_usage',
])
@freeze_time("2015-01-01 15:15:15.000000")
def test_stats_pages_show_last_3_years(
client_request,
endpoint,
mock_get_monthly_notification_stats,
mock_get_monthly_template_usage,
):
page = client_request.get(
endpoint,
service_id=SERVICE_ONE_ID,
)
assert normalize_spaces(page.select_one('.pill').text) == (
'2012 to 2013 financial year '
'2013 to 2014 financial year '
'2014 to 2015 financial year'
)
def test_monthly_has_equal_length_tables(
client_request,
service_one,