From d2fd5ab07d4dcbc3af3a37822ff5456fda9d5c1b Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Mon, 15 May 2023 14:37:05 -0600 Subject: [PATCH] Added display of daily limit and remaining amount after csv upload --- app/main/views/send.py | 6 +++++- app/templates/service_navigation.html | 1 + app/templates/views/check/ok.html | 7 ++++++- app/templates/views/send.html | 7 +++++++ tests/app/main/views/accounts/test_choose_accounts.py | 2 +- tests/app/main/views/test_send.py | 2 +- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index 764b3daee..53e8eaa9d 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -80,6 +80,9 @@ def get_example_csv_rows(template, use_example_as_example=True, submitted_fields @main.route("/services//send//csv", methods=['GET', 'POST']) @user_has_permissions('send_messages', restrict_admin_usage=True) def send_messages(service_id, template_id): + notification_count = service_api_client.get_notification_count(service_id) + remaining_messages = (current_service.message_limit - notification_count) + db_template = current_service.get_template_with_user_permission_or_403(template_id, current_user) email_reply_to = None @@ -154,7 +157,8 @@ def send_messages(service_id, template_id): column_headings=list(ascii_uppercase[:len(column_headings)]), example=[column_headings, get_example_csv_rows(template)], form=form, - allowed_file_extensions=Spreadsheet.ALLOWED_FILE_EXTENSIONS + allowed_file_extensions=Spreadsheet.ALLOWED_FILE_EXTENSIONS, + remaining_messages=remaining_messages ) diff --git a/app/templates/service_navigation.html b/app/templates/service_navigation.html index 3271603f6..d5f0ce807 100644 --- a/app/templates/service_navigation.html +++ b/app/templates/service_navigation.html @@ -1,6 +1,7 @@ {% macro navigation_service_name(service) %}