Skip to content

Commit

Permalink
add carrier column to reports
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Kehl committed Nov 21, 2024
1 parent daabee6 commit 8f30064
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .ds.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"filename": "app/config.py",
"hashed_secret": "577a4c667e4af8682ca431857214b3a920883efc",
"is_verified": false,
"line_number": 125,
"line_number": 123,
"is_secret": false
}
],
Expand Down Expand Up @@ -684,5 +684,5 @@
}
]
},
"generated_at": "2024-11-14T15:53:44Z"
"generated_at": "2024-11-21T23:08:45Z"
}
4 changes: 1 addition & 3 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ class Config(object):
getenv("FEATURE_BEST_PRACTICES_ENABLED", "false") == "true"
)

FEATURE_ABOUT_PAGE_ENABLED = (
getenv("FEATURE_ABOUT_PAGE_ENABLED", "false") == "true"
)
FEATURE_ABOUT_PAGE_ENABLED = getenv("FEATURE_ABOUT_PAGE_ENABLED", "false") == "true"


def _s3_credentials_from_env(bucket_prefix):
Expand Down
10 changes: 4 additions & 6 deletions app/main/views/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@
# Hook to check for feature flags
@main.before_request
def check_feature_flags():
if (
request.path.startswith("/guides/best-practices")
and not current_app.config.get("FEATURE_BEST_PRACTICES_ENABLED", False)
if request.path.startswith("/guides/best-practices") and not current_app.config.get(
"FEATURE_BEST_PRACTICES_ENABLED", False
):
abort(404)

if (
request.path.startswith("/about")
and not current_app.config.get("FEATURE_ABOUT_PAGE_ENABLED", False)
if request.path.startswith("/about") and not current_app.config.get(
"FEATURE_ABOUT_PAGE_ENABLED", False
):
abort(404)

Expand Down
2 changes: 1 addition & 1 deletion app/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class HeaderNavigation(Navigation):
"establish_trust",
"write_for_action",
"multiple_languages",
"benchmark_performance"
"benchmark_performance",
},
"using_notify": {
"get_started",
Expand Down
4 changes: 4 additions & 0 deletions app/utils/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def generate_notifications_csv(**kwargs):
"Carrier Response",
"Status",
"Time",
"Carrier",
]
for header in original_column_headers:
if header.lower() != "phone number":
Expand All @@ -118,6 +119,7 @@ def generate_notifications_csv(**kwargs):
"Carrier Response",
"Status",
"Time",
"Carrier",
]

yield ",".join(fieldnames) + "\n"
Expand All @@ -140,6 +142,7 @@ def generate_notifications_csv(**kwargs):
notification["provider_response"],
notification["status"],
preferred_tz_created_at,
notification["carrier"],
]
for header in original_column_headers:
if header.lower() != "phone number":
Expand All @@ -158,6 +161,7 @@ def generate_notifications_csv(**kwargs):
notification["provider_response"],
notification["status"],
preferred_tz_created_at,
notification["carrier"],
]
yield Spreadsheet.from_rows([map(str, values)]).as_csv_data

Expand Down
15 changes: 11 additions & 4 deletions tests/app/utils/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def _get(
"to": recipient,
"recipient": recipient,
"client_reference": "ref 1234",
"carrier": "AT&T Mobility",
}
for i in range(rows)
],
Expand Down Expand Up @@ -88,15 +89,15 @@ def get_notifications_csv_mock(
(
None,
[
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time\n",
"8005555555,foo,,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n",
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time,Carrier\n",
"8005555555,foo,,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern,AT&T Mobility\r\n",
],
),
(
"Anne Example",
[
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time\n",
"8005555555,foo,Anne Example,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern\r\n", # noqa
"Phone Number,Template,Sent by,Batch File,Carrier Response,Status,Time,Carrier\n",
"8005555555,foo,Anne Example,,Did not like it,Delivered,1943-04-19 08:00:00 AM US/Eastern,AT&T Mobility\r\n", # noqa
],
),
],
Expand Down Expand Up @@ -135,6 +136,7 @@ def test_generate_notifications_csv_without_job(
"Carrier Response",
"Status",
"Time",
"Carrier",
],
[
"8005555555",
Expand All @@ -144,6 +146,7 @@ def test_generate_notifications_csv_without_job(
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"AT&T Mobility",
],
),
(
Expand All @@ -159,6 +162,7 @@ def test_generate_notifications_csv_without_job(
"Carrier Response",
"Status",
"Time",
"Carrier",
"a",
"b",
"c",
Expand All @@ -171,6 +175,7 @@ def test_generate_notifications_csv_without_job(
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"AT&T Mobility",
"🐜",
"🐝",
"πŸ¦€",
Expand All @@ -189,6 +194,7 @@ def test_generate_notifications_csv_without_job(
"Carrier Response",
"Status",
"Time",
"Carrier",
"a",
"b",
"c",
Expand All @@ -201,6 +207,7 @@ def test_generate_notifications_csv_without_job(
"Did not like it",
"Delivered",
"1943-04-19 08:00:00 AM US/Eastern",
"AT&T Mobility",
"🐜,🐜",
"🐝,🐝",
"πŸ¦€",
Expand Down

0 comments on commit 8f30064

Please sign in to comment.