mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-03-13 23:02:43 -04:00
Always show letter counts on dashboard
We hid letters originally because it wasn’t a mature feature. We rolled it out by letting teams choose to use it (#1803) and then automatically giving it to new teams (notifications-api/#1600). This commit doesn’t change who has access to letters, but it does make it more discoverable by revealing it in the UI. This is the same thing we do for emails/texts, where even if you switch them off they still show up on the dashboard and usage page.
This commit is contained in:
@@ -290,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(
|
||||
|
||||
@@ -27,19 +27,17 @@
|
||||
smaller=smaller_font_size
|
||||
) }}
|
||||
</div>
|
||||
{% if current_service.has_permission('letter') %}
|
||||
<div id="total-letters" class="{{column_width}}">
|
||||
{{ big_number_with_status(
|
||||
statistics['letter']['requested'],
|
||||
message_count_label(statistics['letter']['requested'], 'letter', suffix='sent'),
|
||||
statistics['letter']['failed'],
|
||||
statistics['letter']['failed_percentage'],
|
||||
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
|
||||
) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="total-letters" class="{{column_width}}">
|
||||
{{ big_number_with_status(
|
||||
statistics['letter']['requested'],
|
||||
message_count_label(statistics['letter']['requested'], 'letter', suffix='sent'),
|
||||
statistics['letter']['failed'],
|
||||
statistics['letter']['failed_percentage'],
|
||||
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
|
||||
) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -645,71 +645,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(
|
||||
@@ -723,7 +678,6 @@ def test_correct_font_size_for_big_numbers(
|
||||
permissions,
|
||||
totals,
|
||||
big_number_class,
|
||||
expected_column_count,
|
||||
):
|
||||
|
||||
service_one['permissions'] = permissions
|
||||
@@ -738,9 +692,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")
|
||||
|
||||
Reference in New Issue
Block a user