+ Was sent on {{ job.created_at|format_datetime_short_12h }} by {{ job.created_by.name }}
+
+
+
{% endif %}
{% if job.status == 'sending limits exceeded'%}
diff --git a/app/templates/views/notifications/notification.html b/app/templates/views/notifications/notification.html
index cf61250ed..9c921729d 100644
--- a/app/templates/views/notifications/notification.html
+++ b/app/templates/views/notifications/notification.html
@@ -24,18 +24,16 @@
{% if help %}
‘{{ template.name }}’
{% else %}
- ‘{{ template.name }}’
+
{% endif %}
- was sent
- {% if job and job.original_file_name != 'Report' %}
- {% set destination =
- {'email': 'an email address', 'sms': 'a phone number'} %}
- to {{ destination[template.template_type] }} from
- {{ job.original_file_name }}
- {% elif created_by %}
- by {{ created_by.name }}
- {% endif %}
- {{ created_at|format_datetime_human }}
+
+
+
{{ template.name }} - {{ current_service.name }}
+
+ Was sent on {{ created_at|format_datetime_short_12h }} by {{ created_by.name }}
+
+
+
diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py
index 323a1fe00..74fd6371a 100644
--- a/tests/app/main/views/test_jobs.py
+++ b/tests/app/main/views/test_jobs.py
@@ -237,11 +237,11 @@ def test_should_show_job_with_sending_limit_exceeded_status(
job_id=fake_uuid,
)
- assert normalize_spaces(page.select("main p")[1].text) == (
+ assert normalize_spaces(page.select("main p")[2].text) == (
"Notify cannot send these messages because you have reached a limit. "
"You can only send 1,000 messages per day and 250,000 messages in total."
)
- assert normalize_spaces(page.select("main p")[2].text) == (
+ assert normalize_spaces(page.select("main p")[3].text) == (
"Upload this spreadsheet again tomorrow or contact the Notify.gov team to raise the limit."
)
@@ -350,7 +350,7 @@ def test_should_show_scheduled_job(
)
assert normalize_spaces(page.select("main div p")[1].text) == (
- "Sending Two week reminder today at 00:00 US/Eastern"
+ "Was scheduled on 2 January at 12:00 AM US/Eastern by Test User"
)
assert page.select("main p a")[0]["href"] == url_for(
@@ -425,7 +425,9 @@ def test_should_show_updates_for_one_job_as_json(
assert "Status" in content["notifications"]
assert "Delivered" in content["notifications"]
assert "00:00" in content["notifications"]
- assert "Sent by Test User on 1 January at 00:00" in content["status"]
+ assert (
+ "Was sent on 1 January at 12:00 AM US/Eastern by Test User" in content["status"]
+ )
@freeze_time("2016-01-01 05:00:00.000001")
@@ -467,7 +469,9 @@ def test_should_show_updates_for_scheduled_job_as_json(
assert "Status" in content["notifications"]
assert "Delivered" in content["notifications"]
assert "00:00" in content["notifications"]
- assert "Sent by Test User on 1 June at 16:00" in content["status"]
+ assert (
+ "Was sent on 1 January at 12:00 AM US/Eastern by Test User" in content["status"]
+ )
@pytest.mark.parametrize(
diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py
index 7020cd3e0..61a7f495d 100644
--- a/tests/app/main/views/test_notifications.py
+++ b/tests/app/main/views/test_notifications.py
@@ -226,22 +226,30 @@ def test_notification_status_shows_expected_back_link(
[
(
"2012-01-01 06:01",
- ("‘sample template’ was sent by Test User today at 01:01 US/Eastern"),
+ (
+ "‘sample template’ sample template - service one Was sent on 1 January at 01:01 AM US/Eastern "
+ "by Test User"
+ ),
),
(
"2012-01-02 06:01",
- ("‘sample template’ was sent by Test User yesterday at 01:01 US/Eastern"),
+ (
+ "‘sample template’ sample template - service one Was sent on 1 January at 01:01 AM US/Eastern "
+ "by Test User"
+ ),
),
(
"2012-01-03 06:01",
(
- "‘sample template’ was sent by Test User on 1 January at 01:01 US/Eastern"
+ "‘sample template’ sample template - service one Was sent on 1 January at 01:01 AM US/Eastern "
+ "by Test User"
),
),
(
"2013-01-03 06:01",
(
- "‘sample template’ was sent by Test User on 1 January 2012 at 01:01 US/Eastern"
+ "‘sample template’ sample template - service one Was sent on 1 January at 01:01 AM US/Eastern "
+ "by Test User"
),
),
],
From 4eb886d8c026d780bc8dd241fe256b694bdbfe5d Mon Sep 17 00:00:00 2001
From: Beverly Nguyen
Date: Tue, 13 Feb 2024 18:18:13 -0800
Subject: [PATCH 02/43] update test
---
.../views/notifications/notification.html | 28 ++++++++-----------
tests/app/main/views/test_notifications.py | 18 ++++--------
2 files changed, 17 insertions(+), 29 deletions(-)
diff --git a/app/templates/views/notifications/notification.html b/app/templates/views/notifications/notification.html
index 9c921729d..5a03daf3d 100644
--- a/app/templates/views/notifications/notification.html
+++ b/app/templates/views/notifications/notification.html
@@ -20,26 +20,20 @@
{{ page_header(
1|message_count_label(template.template_type, suffix='') | capitalize
) }}
-
- {% if help %}
- ‘{{ template.name }}’
- {% else %}
-
- {% endif %}
-
-
-
{{ template.name }} - {{ current_service.name }}
-
- Was sent on {{ created_at|format_datetime_short_12h }} by {{ created_by.name }}
-
-
+ {% if help %}
+
‘{{ template.name }}’
+ {% endif %}
+
+
+
{{ template.name }} - {{ current_service.name }}
+
+ Was sent on {{ created_at|format_datetime_short_12h }} by {{ created_by.name }}
+
- Was scheduled on {{ job.scheduled_for|format_datetime_short_12h }} by {{ job.created_by.name }}
+ {{ job.template_name }} - {{ current_service.name }} was scheduled on {{ job.scheduled_for|format_datetime_short_12h }} by {{ job.created_by.name }}
- Was sent on {{ created_at|format_datetime_short_12h }} by {{ created_by.name }}
+ was sent
+ {% if job and job.original_file_name != 'Report' %}
+ {% set destination =
+ {'email': 'an email address', 'sms': 'a phone number'} %}
+ to {{ destination[template.template_type] }} from
+ {{ job.original_file_name }}
+ {% elif created_by %}
+ by {{ created_by.name }}
+ {% endif %}
+ {{ created_at|format_datetime_human }}
-
-
- {{ template|string }}
+
+ {{ template|string }}
+
{% if template.template_type == 'email' %}
diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py
index 7448c44cf..c1714c668 100644
--- a/tests/app/main/views/test_send.py
+++ b/tests/app/main/views/test_send.py
@@ -2056,7 +2056,7 @@ def test_create_job_should_call_api(
_expected_status=200,
)
- assert original_file_name in page.text
+ assert "Message status" in page.text
mock_create_job.assert_called_with(
job_id,
From fd340ed1051e6c5e1500b54748489aac036419fd Mon Sep 17 00:00:00 2001
From: Beverly Nguyen
Date: Fri, 23 Feb 2024 14:59:25 -0800
Subject: [PATCH 08/43] update test
---
tests/app/main/views/test_notifications.py | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py
index ce7bcab63..2d1ac37b4 100644
--- a/tests/app/main/views/test_notifications.py
+++ b/tests/app/main/views/test_notifications.py
@@ -226,26 +226,22 @@ def test_notification_status_shows_expected_back_link(
[
(
"2012-01-01 06:01",
- (
- "Was sent on 1 January at 01:01 AM US/Eastern by Test User"
- ),
+ ("‘sample template’ was sent by Test User today at 01:01 US/Eastern"),
),
(
"2012-01-02 06:01",
- (
- "Was sent on 1 January at 01:01 AM US/Eastern by Test User"
- ),
+ ("‘sample template’ was sent by Test User yesterday at 01:01 US/Eastern"),
),
(
"2012-01-03 06:01",
(
- "Was sent on 1 January at 01:01 AM US/Eastern by Test User"
+ "‘sample template’ was sent by Test User on 1 January at 01:01 US/Eastern"
),
),
(
"2013-01-03 06:01",
(
- "Was sent on 1 January at 01:01 AM US/Eastern by Test User"
+ "‘sample template’ was sent by Test User on 1 January 2012 at 01:01 US/Eastern"
),
),
],
@@ -271,8 +267,6 @@ def test_notification_page_doesnt_link_to_template_in_tour(
notification_id=fake_uuid,
help=3,
)
- p_text = normalize_spaces(page.select_one(".usa-alert__text").text)
- assert p_text == normalize_spaces(expected_message)
assert len(page.select("main p:nth-of-type(1) a")) == 0
From d08968a34815bb6ae5f8bbea4dbad02a93caae01 Mon Sep 17 00:00:00 2001
From: Beverly Nguyen
Date: Fri, 23 Feb 2024 15:02:18 -0800
Subject: [PATCH 09/43] update test
---
app/main/views/send.py | 28 ++++++++-----------
.../views/notifications/notification.html | 12 ++++----
2 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/app/main/views/send.py b/app/main/views/send.py
index 10f74bb41..d45c1909f 100644
--- a/app/main/views/send.py
+++ b/app/main/views/send.py
@@ -52,14 +52,12 @@ def get_example_csv_fields(column_headers, use_example_as_example, submitted_fie
def get_example_csv_rows(template, use_example_as_example=True, submitted_fields=False):
return {
- "email": (
- ["test@example.com"]
- if use_example_as_example
- else [current_user.email_address]
- ),
- "sms": (
- ["12223334444"] if use_example_as_example else [current_user.mobile_number]
- ),
+ "email": ["test@example.com"]
+ if use_example_as_example
+ else [current_user.email_address],
+ "sms": ["12223334444"]
+ if use_example_as_example
+ else [current_user.mobile_number],
}[template.template_type] + get_example_csv_fields(
(
placeholder
@@ -513,14 +511,12 @@ def _check_messages(service_id, template_id, upload_id, preview_row):
template=template,
max_initial_rows_shown=50,
max_errors_shown=50,
- guestlist=(
- itertools.chain.from_iterable(
- [user.name, user.mobile_number, user.email_address]
- for user in Users(service_id)
- )
- if current_service.trial_mode
- else None
- ),
+ guestlist=itertools.chain.from_iterable(
+ [user.name, user.mobile_number, user.email_address]
+ for user in Users(service_id)
+ )
+ if current_service.trial_mode
+ else None,
remaining_messages=remaining_messages,
allow_international_sms=current_service.has_permission("international_sms"),
)
diff --git a/app/templates/views/notifications/notification.html b/app/templates/views/notifications/notification.html
index e5a41d422..cf61250ed 100644
--- a/app/templates/views/notifications/notification.html
+++ b/app/templates/views/notifications/notification.html
@@ -20,13 +20,13 @@
{{ page_header(
1|message_count_label(template.template_type, suffix='') | capitalize
) }}
-
- {% if help %}
- ‘{{ template.name }}’
+
+ {% if help %}
+ ‘{{ template.name }}’
{% else %}
‘{{ template.name }}’
- {% endif %}
- was sent
+ {% endif %}
+ was sent
{% if job and job.original_file_name != 'Report' %}
{% set destination =
{'email': 'an email address', 'sms': 'a phone number'} %}
@@ -36,7 +36,7 @@
by {{ created_by.name }}
{% endif %}
{{ created_at|format_datetime_human }}
-
+
{{ template|string }}
From 039b7cdece8dbe078de3807b3b4a8aa4d42fadd8 Mon Sep 17 00:00:00 2001
From: Beverly Nguyen
Date: Fri, 23 Feb 2024 15:14:54 -0800
Subject: [PATCH 10/43] update test
---
tests/app/main/views/test_performance.py | 28 ++++++++++++------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/tests/app/main/views/test_performance.py b/tests/app/main/views/test_performance.py
index ef2ed06be..5ceb5288b 100644
--- a/tests/app/main/views/test_performance.py
+++ b/tests/app/main/views/test_performance.py
@@ -116,26 +116,26 @@ def test_should_render_performance_page(
""
"Messages sent since May 2023 "
"Date Emails Text messages "
- "27 February 2021 1 2 "
- "26 February 2021 1 2 "
- "25 February 2021 1 2 "
- "24 February 2021 1 2 "
- "23 February 2021 1 2 "
- "22 February 2021 1 2 "
- "21 February 2021 1,234,567 123,456 "
+ "February 27, 2021 1 2 "
+ "February 26, 2021 1 2 "
+ "February 25, 2021 1 2 "
+ "February 24, 2021 1 2 "
+ "February 23, 2021 1 2 "
+ "February 22, 2021 1 2 "
+ "February 21, 2021 1,234,567 123,456 "
"Only showing the last 7 days "
""
"Messages sent within 10 seconds "
"98.31% on average "
"Messages sent within 10 seconds "
"Date Percentage "
- "27 February 2021 98.60% "
- "26 February 2021 100.00% "
- "25 February 2021 99.99% "
- "24 February 2021 100.00% "
- "23 February 2021 95.00% "
- "22 February 2021 95.30% "
- "21 February 2021 99.25% "
+ "February 27, 2021 98.60% "
+ "February 26, 2021 100.00% "
+ "February 25, 2021 99.99% "
+ "February 24, 2021 100.00% "
+ "February 23, 2021 95.00% "
+ "February 22, 2021 95.30% "
+ "February 21, 2021 99.25% "
"Only showing the last 7 days "
""
"Organizations using Notify "
From 58e252f092b751a645d76c71f14381f2fe39c1a8 Mon Sep 17 00:00:00 2001
From: Beverly Nguyen
Date: Mon, 26 Feb 2024 12:25:53 -0800
Subject: [PATCH 11/43] updated Delivery Status title
---
app/templates/partials/jobs/status.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/templates/partials/jobs/status.html b/app/templates/partials/jobs/status.html
index e01e356a2..858a4ff10 100644
--- a/app/templates/partials/jobs/status.html
+++ b/app/templates/partials/jobs/status.html
@@ -16,7 +16,7 @@
{% endif %}
-
SMS Status
+
Delivery Status
{% endset %}
From ee5fe38001748f13768fcff16ce9687699852cc1 Mon Sep 17 00:00:00 2001
From: Beverly Nguyen
Date: Fri, 8 Mar 2024 11:30:49 -0800
Subject: [PATCH 12/43] update testing
---
app/main/views/send.py | 5 +++++
tests/app/main/views/test_jobs.py | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/app/main/views/send.py b/app/main/views/send.py
index 10f74bb41..3ca38171b 100644
--- a/app/main/views/send.py
+++ b/app/main/views/send.py
@@ -912,6 +912,11 @@ def send_notification(service_id, template_id):
".view_job",
service_id=service_id,
job_id=upload_id,
+ from_job=upload_id,
+ notification_id=notifications["notifications"][0]["id"],
+ # used to show the final step of the tour (help=3) or not show
+ # a back link on a just sent one off notification (help=0)
+ help=request.args.get("help"),
)
)
diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py
index c7afce860..9e04cdf21 100644
--- a/tests/app/main/views/test_jobs.py
+++ b/tests/app/main/views/test_jobs.py
@@ -424,7 +424,7 @@ def test_should_show_updates_for_one_job_as_json(
assert "2021234567" in content["notifications"]
assert "Status" in content["notifications"]
assert "Delivered" in content["notifications"]
- assert "00:00" in content["notifications"]
+ assert "01-01-2016 at 12:00 AM" in content["notifications"]
@freeze_time("2016-01-01 05:00:00.000001")
@@ -465,7 +465,7 @@ def test_should_show_updates_for_scheduled_job_as_json(
assert "2021234567" in content["notifications"]
assert "Status" in content["notifications"]
assert "Delivered" in content["notifications"]
- assert "00:00" in content["notifications"]
+ assert "01-01-2016 at 12:00 AM" in content["notifications"]
assert (
"Was sent on 1 January at 12:00 AM US/Eastern by Test User"
)
From b1b416db8c06fd7c1ee5466e49e4fb0523df5396 Mon Sep 17 00:00:00 2001
From: Beverly Nguyen
Date: Fri, 8 Mar 2024 11:43:54 -0800
Subject: [PATCH 13/43] update datetime naming
---
app/__init__.py | 4 ++--
app/formatters.py | 2 +-
app/templates/partials/jobs/status.html | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/__init__.py b/app/__init__.py
index 889a016a8..e605306ed 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -53,7 +53,7 @@ from app.formatters import (
format_datetime_normal,
format_datetime_relative,
format_datetime_short,
- format_datetime_short_12h,
+ format_datetime_text,
format_datetime_short_america,
format_day_of_week,
format_delta,
@@ -554,7 +554,7 @@ def add_template_filters(application):
format_datetime_24h,
format_datetime_normal,
format_datetime_short,
- format_datetime_short_12h,
+ format_datetime_text,
format_datetime_short_america,
valid_phone_number,
linkable_name,
diff --git a/app/formatters.py b/app/formatters.py
index db9f8dc04..f06d282dc 100644
--- a/app/formatters.py
+++ b/app/formatters.py
@@ -98,7 +98,7 @@ def format_datetime_short(date):
)
-def format_datetime_short_12h(date):
+def format_datetime_text(date):
# example: February 20, 2024 at 07:00 PM US/Eastern
return "{} at {} {}".format(
format_date_normal(date), format_time_12h(date), get_user_preferred_timezone()
diff --git a/app/templates/partials/jobs/status.html b/app/templates/partials/jobs/status.html
index 858a4ff10..d9b8ec505 100644
--- a/app/templates/partials/jobs/status.html
+++ b/app/templates/partials/jobs/status.html
@@ -27,7 +27,7 @@
Your text has been scheduled
- {{ job.template_name }} - {{ current_service.name }} was scheduled on {{ job.scheduled_for|format_datetime_short_12h }} by {{ job.created_by.name }}
+ {{ job.template_name }} - {{ current_service.name }} was scheduled on {{ job.scheduled_for|format_datetime_text }} by {{ job.created_by.name }}
@@ -37,7 +37,7 @@
Your text has been sent
- {{ job.template_name }} - {{ current_service.name }} was sent on {{ job.created_at|format_datetime_short_12h }} by {{ job.created_by.name }}
+ {{ job.template_name }} - {{ current_service.name }} was sent on {{ job.created_at|format_datetime_text }} by {{ job.created_by.name }}