diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 3a02451ea..2ae4394b0 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -280,15 +280,8 @@ def get_dashboard_partials(service_id): all_statistics = template_statistics_client.get_template_statistics_for_service(service_id, limit_days=7) template_statistics = aggregate_template_usage(all_statistics) stats = aggregate_notifications_stats(all_statistics) - column_width, max_notifiction_count = get_column_properties(3) dashboard_totals = get_dashboard_totals(stats), - highest_notification_count = max( - sum( - value[key] for key in {'requested', 'failed', 'delivered'} - ) - for key, value in dashboard_totals[0].items() - ) free_sms_allowance = billing_api_client.get_free_sms_fragment_limit_for_year( current_service.id, get_current_financial_year(), @@ -312,10 +305,6 @@ def get_dashboard_partials(service_id): 'views/dashboard/_totals.html', service_id=service_id, statistics=dashboard_totals[0], - column_width=column_width, - smaller_font_size=( - highest_notification_count > max_notifiction_count - ), ), 'template-statistics': render_template( 'views/dashboard/template-statistics.html', @@ -330,7 +319,6 @@ def get_dashboard_partials(service_id): ), 'usage': render_template( 'views/dashboard/_usage.html', - column_width=column_width, **calculate_usage(yearly_usage, free_sms_allowance), ), } @@ -505,10 +493,3 @@ def get_tuples_of_financial_years( ) for year in range(start, end + 1) ) - - -def get_column_properties(number_of_columns): - return { - 2: ('column-half', 999999999), - 3: ('column-third', 99999), - }.get(number_of_columns) diff --git a/app/templates/views/dashboard/_totals.html b/app/templates/views/dashboard/_totals.html index 778862a4c..b979d9b18 100644 --- a/app/templates/views/dashboard/_totals.html +++ b/app/templates/views/dashboard/_totals.html @@ -3,7 +3,7 @@
-
+
{{ big_number_with_status( statistics['email']['requested'], message_count_label(statistics['email']['requested'], 'email', suffix='sent'), @@ -12,10 +12,10 @@ statistics['email']['show_warning'], failure_link=url_for(".view_notifications", service_id=service_id, message_type='email', status='failed'), link=url_for(".view_notifications", service_id=service_id, message_type='email', status='sending,delivered,failed'), - smaller=smaller_font_size + smaller=True, ) }}
-
+
{{ big_number_with_status( statistics['sms']['requested'], message_count_label(statistics['sms']['requested'], 'sms', suffix='sent'), @@ -24,10 +24,10 @@ statistics['sms']['show_warning'], failure_link=url_for(".view_notifications", service_id=service_id, message_type='sms', status='failed'), link=url_for(".view_notifications", service_id=service_id, message_type='sms', status='sending,delivered,failed'), - smaller=smaller_font_size + smaller=True, ) }}
-
+
{{ big_number_with_status( statistics['letter']['requested'], message_count_label(statistics['letter']['requested'], 'letter', suffix='sent'), @@ -36,7 +36,7 @@ statistics['letter']['show_warning'], failure_link=url_for(".view_notifications", service_id=service_id, message_type='letter', status='failed'), link=url_for(".view_notifications", service_id=service_id, message_type='letter', status=''), - smaller=smaller_font_size + smaller=True, ) }}
diff --git a/app/templates/views/dashboard/_usage.html b/app/templates/views/dashboard/_usage.html index 6dc53b630..89a9b33d6 100644 --- a/app/templates/views/dashboard/_usage.html +++ b/app/templates/views/dashboard/_usage.html @@ -1,12 +1,12 @@ {% from "components/big-number.html" import big_number %}
-
+
{{ big_number("Unlimited", 'free email allowance', smaller=True) }}
-
+
{% if sms_chargeable %} {{ big_number( @@ -20,7 +20,7 @@ {% endif %}
-
+
{{ big_number( letter_cost, diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index a75066840..fd95ee7b9 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -553,7 +553,7 @@ def test_should_not_show_recent_templates_on_dashboard_if_only_one_template_used expected_count = stats[0]['count'] assert expected_count == 50 assert normalize_spaces( - page.select_one('#total-sms .big-number').text + page.select_one('#total-sms .big-number-smaller').text ) == ( '{} text messages sent'.format(expected_count) ) @@ -713,14 +713,13 @@ def test_should_show_upcoming_jobs_on_dashboard( ['email', 'sms'], ['email', 'sms', 'letter'], )) -@pytest.mark.parametrize('totals, big_number_class', [ +@pytest.mark.parametrize('totals', [ ( { 'email': {'requested': 0, 'delivered': 0, 'failed': 0}, 'sms': {'requested': 99999, 'delivered': 0, 'failed': 0}, 'letter': {'requested': 99999, 'delivered': 0, 'failed': 0} }, - '.big-number', ), ( { @@ -728,7 +727,6 @@ def test_should_show_upcoming_jobs_on_dashboard( 'sms': {'requested': 0, 'delivered': 0, 'failed': 0}, 'letter': {'requested': 100000, 'delivered': 0, 'failed': 0}, }, - '.big-number-smaller', ), ]) def test_correct_font_size_for_big_numbers( @@ -743,7 +741,6 @@ def test_correct_font_size_for_big_numbers( service_one, permissions, totals, - big_number_class, ): service_one['permissions'] = permissions @@ -758,11 +755,12 @@ def test_correct_font_size_for_big_numbers( service_id=service_one['id'], ) - assert len(page.select_one('[data-key=totals]').select('.column-third')) == 3 - assert len(page.select_one('[data-key=usage]').select('.column-third')) == 3 - - assert len( - page.select('.big-number-with-status {}'.format(big_number_class)) + assert ( + len(page.select_one('[data-key=totals]').select('.column-third')) + ) == ( + len(page.select_one('[data-key=usage]').select('.column-third')) + ) == ( + len(page.select('.big-number-with-status .big-number-smaller')) ) == 3