Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let a user upload a recipient spreadsheet in either EN or FR #1676

Merged
merged 7 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test_endpoints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
echo "PYTHONPATH=/github/workspace/env/site-packages:${{ env.PYTHONPATH}}" >> $GITHUB_ENV

- name: Checks for new endpoints against AWS WAF rules
uses: cds-snc/notification-utils/.github/actions/waffles@a6ed8d1bc1b70780a204912e4266b1981b330bae # 52.0.4
uses: cds-snc/notification-utils/.github/actions/waffles@08ba5512ae392390b6c991042858f3cbe4e8aa95 # 52.0.11
with:
app-loc: '/github/workspace'
app-libs: '/github/workspace/env/site-packages'
Expand Down
10 changes: 7 additions & 3 deletions app/main/views/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

from app import (
current_service,
get_current_locale,
job_api_client,
notification_api_client,
redis_client,
Expand Down Expand Up @@ -628,7 +629,7 @@ def send_test_preview(service_id, template_id, filetype):
return TemplatePreview.from_utils_template(template, filetype, page=request.args.get("page"))


def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_pdf=False):
def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_pdf=False, user_language="en"):
try:
# The happy path is that the job doesn’t already exist, so the
# API will return a 404 and the client will raise HTTPError.
Expand Down Expand Up @@ -692,6 +693,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
remaining_messages=recipients_remaining_messages,
international_sms=current_service.has_permission("international_sms"),
max_rows=get_csv_max_rows(service_id),
user_language=user_language,
)

if request.args.get("from_test"):
Expand Down Expand Up @@ -764,7 +766,8 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
)
@user_has_permissions("send_messages", restrict_admin_usage=True)
def check_messages(service_id, template_id, upload_id, row_index=2):
data = _check_messages(service_id, template_id, upload_id, row_index)
current_lang = get_current_locale(current_app)
data = _check_messages(service_id, template_id, upload_id, row_index, user_language=current_lang)
all_statistics_daily = template_statistics_client.get_template_statistics_for_service(service_id, limit_days=1)
data["stats_daily"] = aggregate_notifications_stats(all_statistics_daily)
data["time_to_reset"] = get_limit_reset_time_et()
Expand Down Expand Up @@ -1142,9 +1145,10 @@ def get_sms_sender_from_session():


def get_spreadsheet_column_headings_from_template(template):
current_lang = get_current_locale(current_app)
column_headings = []

for column_heading in first_column_headings[template.template_type] + list(template.placeholders):
for column_heading in first_column_headings[current_lang][template.template_type] + list(template.placeholders):
if column_heading not in Columns.from_keys(column_headings):
column_headings.append(column_heading)

Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ awscli-cwlogs = "^1.4.6"
# Putting upgrade on hold due to v1.0.0 using sha512 instead of sha1 by default
itsdangerous = "2.1.2" # pyup: <1.0.0

notifications-utils = {git = "https://github.com/cds-snc/notifier-utils.git", rev = "52.0.9"}
notifications-utils = {git = "https://github.com/cds-snc/notifier-utils.git", rev = "52.0.11"}

rsa = "^4.1" # not directly required, pinned by Snyk to avoid a vulnerability
unidecode = "^1.3.6"
Expand Down
Loading