From 7b6b363532cfbf6197ad199fe27dea4f6349c1c0 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 26 Aug 2024 09:02:39 -0700 Subject: [PATCH] add a call on the send page as well --- app/main/views/dashboard.py | 13 +------------ app/main/views/send.py | 2 ++ app/main/views/user_profile.py | 12 ++++++++++++ app/templates/views/send.html | 1 + 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 2a7b3e76ee..213624329d 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -25,6 +25,7 @@ ) from app.formatters import format_date_numeric, format_datetime_numeric, get_time_left from app.main import main +from app.main.views.user_profile import set_timezone from app.statistics_utils import get_formatted_percentage from app.utils import ( DELIVERED_STATUSES, @@ -552,15 +553,3 @@ def get_tuples_of_financial_years( ) for year in reversed(range(start, end + 1)) ) - - -def set_timezone(): - # Cookie is set in dashboard.html on page load - try: - timezone = request.cookies.get("timezone", "US/Eastern") - current_app.logger.debug(hilite(f"User's timezone is {timezone}")) - serialized_user = current_user.serialize() - if serialized_user["preferred_timezone"] is not timezone: - current_user.update(preferred_timezone=timezone) - except Exception: - current_app.logger.exception(hilite("Can't get timezone")) diff --git a/app/main/views/send.py b/app/main/views/send.py index 6f2817826f..e6843da18d 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -33,6 +33,7 @@ SetSenderForm, get_placeholder_form_instance, ) +from app.main.views.user_profile import set_timezone from app.models.user import Users from app.s3_client.s3_csv_client import ( get_csv_metadata, @@ -1075,6 +1076,7 @@ def get_spreadsheet_column_headings_from_template(template): def get_recipient(): + set_timezone() if {"recipient", "placeholders"} - set(session.keys()): return None diff --git a/app/main/views/user_profile.py b/app/main/views/user_profile.py index 2efac8b236..bec6268b52 100644 --- a/app/main/views/user_profile.py +++ b/app/main/views/user_profile.py @@ -275,3 +275,15 @@ def user_profile_disable_platform_admin_view(): return render_template( "views/user-profile/disable-platform-admin-view.html", form=form ) + + +def set_timezone(): + # Cookie is set in dashboard.html on page load + try: + timezone = request.cookies.get("timezone", "US/Eastern") + current_app.logger.debug(f"User's timezone is {timezone}") + serialized_user = current_user.serialize() + if serialized_user["preferred_timezone"] is not timezone: + current_user.update(preferred_timezone=timezone) + except Exception: + current_app.logger.exception(hilite("Can't get timezone")) diff --git a/app/templates/views/send.html b/app/templates/views/send.html index 8685f81968..b8a0c65610 100644 --- a/app/templates/views/send.html +++ b/app/templates/views/send.html @@ -4,6 +4,7 @@ {% from "components/file-upload.html" import file_upload %} {% from "components/table.html" import list_table, text_field, index_field, index_field_heading %} {% from "components/components/back-link/macro.njk" import usaBackLink %} + {% block service_page_title %} Upload a list of {{ 999|recipient_count_label(template.template_type) }}