diff --git a/app/main/views/jobs.py b/app/main/views/jobs.py index b7f9a5d70..147078e5c 100644 --- a/app/main/views/jobs.py +++ b/app/main/views/jobs.py @@ -446,7 +446,10 @@ def get_job_partials(job, template): counts = render_template( 'partials/count.html', counts=_get_job_counts(job), - status=filter_args['status'] + status=filter_args['status'], + notifications_deleted=( + job['job_status'] == 'finished' and not notifications['notifications'] + ), ) service_data_retention_days = current_service.get_days_of_retention(template['template_type']) can_letter_job_be_cancelled = False diff --git a/app/templates/partials/count.html b/app/templates/partials/count.html index eb2990161..c66b6bff2 100644 --- a/app/templates/partials/count.html +++ b/app/templates/partials/count.html @@ -1,5 +1,18 @@ +{% from "components/big-number.html" import big_number %} {% from "components/pill.html" import pill %} -
- {{ pill(counts, request.args.get('status', '')) }} +
+ {% if notifications_deleted %} +
+ {% for label, query_param, url, count in counts %} +
+ {{ big_number(count, label, smaller=True) }} +
+ {% endfor %} +
+ {% else %} +
+ {{ pill(counts, request.args.get('status', '')) }} +
+ {% endif %}
diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 7832f8b20..62c78641f 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -294,6 +294,12 @@ def test_should_show_job_in_progress( service_id=service_one['id'], job_id=fake_uuid, ) + assert [ + normalize_spaces(link.text) + for link in page.select('.pill a') + ] == [ + '10 sending', '0 delivered', '0 failed' + ] assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…' @@ -313,6 +319,12 @@ def test_should_show_job_without_notifications( service_id=service_one['id'], job_id=fake_uuid, ) + assert [ + normalize_spaces(link.text) + for link in page.select('.pill a') + ] == [ + '10 sending', '0 delivered', '0 failed' + ] assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…' assert page.select_one('tbody').text.strip() == 'No messages to show yet…' @@ -333,6 +345,7 @@ def test_should_show_old_job( service_id=service_one['id'], job_id=fake_uuid, ) + assert not page.select('.pill a') assert not page.select('p.hint') assert not page.select('a[download]') assert page.select_one('tbody').text.strip() == (