diff --git a/app/main/views/jobs.py b/app/main/views/jobs.py index 393ab813e..5d60ba998 100644 --- a/app/main/views/jobs.py +++ b/app/main/views/jobs.py @@ -29,7 +29,7 @@ from app import ( notification_api_client, service_api_client, ) -from app.formatters import get_time_left +from app.formatters import get_time_left, message_count_noun from app.main import main from app.main.forms import SearchNotificationsForm from app.models.job import Job @@ -336,6 +336,7 @@ def get_status_filters(service, message_type, statistics): def _get_job_counts(job): + job_type = job.template_type return [ ( label, @@ -349,19 +350,27 @@ def _get_job_counts(job): count ) for label, query_param, count in [ [ - 'total', '', + f'''total + {message_count_noun(job.notification_count, job_type)}''', + '', job.notification_count ], [ - 'sending', 'sending', + f'''sending + {message_count_noun(job.notifications_sending, job_type)}''', + 'sending', job.notifications_sending ], [ - 'delivered', 'delivered', + f'''delivered + {message_count_noun(job.notifications_delivered, job_type)}''', + 'delivered', job.notifications_delivered ], [ - 'failed', 'failed', + f'''failed + {message_count_noun(job.notifications_failed, job_type)}''', + 'failed', job.notifications_failed ] ] diff --git a/app/templates/components/pill.html b/app/templates/components/pill.html index 7024fc494..a07d0e8e0 100644 --- a/app/templates/components/pill.html +++ b/app/templates/components/pill.html @@ -18,7 +18,7 @@ {% if show_count %} {{ big_number(count, **big_number_args) }} {% endif %} -
{{ label }}
+
{{ label | safe }}
{% endfor %} diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 44a0e945c..4f9a420b5 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -190,7 +190,7 @@ def test_should_show_job_in_progress( normalize_spaces(link.text) for link in page.select('.pill a:not(.pill-item--selected)') ] == [ - '10 sending', '0 delivered', '0 failed' + '10 sending text messages', '0 delivered text messages', '0 failed text messages' ] assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…' @@ -215,7 +215,7 @@ def test_should_show_job_without_notifications( normalize_spaces(link.text) for link in page.select('.pill a:not(.pill-item--selected)') ] == [ - '10 sending', '0 delivered', '0 failed' + '10 sending text messages', '0 delivered text messages', '0 failed text messages' ] assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…' assert page.select_one('tbody').text.strip() == 'No messages to show yet…'