diff --git a/app/assets/stylesheets/components/table.scss b/app/assets/stylesheets/components/table.scss index 840d535f6..7be4fb25f 100644 --- a/app/assets/stylesheets/components/table.scss +++ b/app/assets/stylesheets/components/table.scss @@ -98,6 +98,20 @@ } +.usage-table { + + .table-field-heading-first { + width: 35%; // 33.33% + fudge + } + + .table-row { + th { + width: 17.5% // 16.67% + fudge + } + } + +} + %table-field, .table-field { diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 437ff0644..a48761d0f 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -133,11 +133,8 @@ def usage(service_id): units = billing_api_client.get_billable_units(service_id, year) yearly_usage = billing_api_client.get_service_usage(service_id, year) - usage_template = 'views/usage.html' - if current_service.has_permission('letter'): - usage_template = 'views/usage-with-letters.html' return render_template( - usage_template, + 'views/usage.html', months=list(get_free_paid_breakdown_for_billable_units( year, free_sms_allowance, @@ -293,11 +290,8 @@ def get_dashboard_partials(service_id): ] stats = aggregate_notifications_stats(all_statistics) - column_width, max_notifiction_count = get_column_properties( - number_of_columns=( - 3 if current_service.has_permission('letter') else 2 - ) - ) + column_width, max_notifiction_count = get_column_properties(3) + dashboard_totals = get_dashboard_totals(stats), highest_notification_count = max( sum( diff --git a/app/templates/views/dashboard/_totals.html b/app/templates/views/dashboard/_totals.html index a7a9de599..778862a4c 100644 --- a/app/templates/views/dashboard/_totals.html +++ b/app/templates/views/dashboard/_totals.html @@ -27,19 +27,17 @@ smaller=smaller_font_size ) }} - {% if current_service.has_permission('letter') %} -
- Financial year ends 31 March. -
-
- What counts as 1 text message?
- See pricing.
-
- Financial year ends 31 March. + Financial year ends 31 March
What counts as 1 text message?
See pricing.
diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py
index 409c98362..323047750 100644
--- a/tests/app/main/views/test_dashboard.py
+++ b/tests/app/main/views/test_dashboard.py
@@ -684,71 +684,26 @@ def test_should_show_upcoming_jobs_on_dashboard(
assert table_rows[1].find_all('td')[0].text.strip() == '1'
-@pytest.mark.parametrize('permissions, column_name, expected_column_count', [
- (['email', 'sms'], '.column-half', 2),
- (['email', 'letter'], '.column-third', 3),
- (['email', 'sms', 'letter'], '.column-third', 3)
-])
-def test_correct_columns_display_on_dashboard(
- client_request,
- mock_get_service_templates,
- mock_get_template_statistics,
- mock_get_service_statistics,
- mock_get_jobs,
- service_one,
- permissions,
- expected_column_count,
- column_name
-):
-
- service_one['permissions'] = permissions
-
- page = client_request.get(
- 'main.service_dashboard',
- service_id=service_one['id']
- )
-
- assert len(page.select(column_name)) == expected_column_count
-
-
-@pytest.mark.parametrize('permissions, totals, big_number_class, expected_column_count', [
+@pytest.mark.parametrize('permissions', (
+ ['email', 'sms'],
+ ['email', 'sms', 'letter'],
+))
+@pytest.mark.parametrize('totals, big_number_class', [
(
- ['email', 'sms'],
- {
- 'email': {'requested': 0, 'delivered': 0, 'failed': 0},
- 'sms': {'requested': 999999999, 'delivered': 0, 'failed': 0}
- },
- '.big-number',
- 2,
- ),
- (
- ['email', 'sms'],
- {
- 'email': {'requested': 1000000000, 'delivered': 0, 'failed': 0},
- 'sms': {'requested': 1000000, 'delivered': 0, 'failed': 0}
- },
- '.big-number-smaller',
- 2,
- ),
- (
- ['email', 'sms', 'letter'],
{
'email': {'requested': 0, 'delivered': 0, 'failed': 0},
'sms': {'requested': 99999, 'delivered': 0, 'failed': 0},
'letter': {'requested': 99999, 'delivered': 0, 'failed': 0}
},
'.big-number',
- 3,
),
(
- ['email', 'sms', 'letter'],
{
'email': {'requested': 0, 'delivered': 0, 'failed': 0},
'sms': {'requested': 0, 'delivered': 0, 'failed': 0},
'letter': {'requested': 100000, 'delivered': 0, 'failed': 0},
},
'.big-number-smaller',
- 3,
),
])
def test_correct_font_size_for_big_numbers(
@@ -762,7 +717,6 @@ def test_correct_font_size_for_big_numbers(
permissions,
totals,
big_number_class,
- expected_column_count,
):
service_one['permissions'] = permissions
@@ -777,9 +731,11 @@ def test_correct_font_size_for_big_numbers(
service_id=service_one['id'],
)
- assert expected_column_count == len(
+ assert len(page.select('.column-third')) == 3
+
+ assert len(
page.select('.big-number-with-status {}'.format(big_number_class))
- )
+ ) == 3
@freeze_time("2016-01-01 11:09:00.061258")
@@ -834,7 +790,7 @@ def test_usage_page(
mock_get_usage.assert_called_once_with(SERVICE_ONE_ID, 2011)
mock_get_free_sms_fragment_limit.assert_called_with(SERVICE_ONE_ID, 2011)
- cols = page.find_all('div', {'class': 'column-half'})
+ cols = page.find_all('div', {'class': 'column-one-third'})
nav = page.find('ul', {'class': 'pill', 'role': 'tablist'})
nav_links = nav.find_all('a')
@@ -852,7 +808,7 @@ def test_usage_page(
assert 'April' in table
assert 'February' in table
assert 'March' in table
- assert '£15.84' in table
+ assert '£20.59' in table
assert '140 free text messages' in table
assert '£20.30' in table
assert '1,230 text messages at 1.65p' in table