mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-17 19:56:47 -04:00
Added display of daily limit and remaining amount after csv upload
This commit is contained in:
@@ -80,6 +80,9 @@ def get_example_csv_rows(template, use_example_as_example=True, submitted_fields
|
||||
@main.route("/services/<uuid:service_id>/send/<uuid:template_id>/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
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{% macro navigation_service_name(service) %}
|
||||
<div class="navigation-service-name govuk-!-font-weight-bold">
|
||||
{{ service.name }}
|
||||
<p class="govuk-body"> Daily Message Limit: {{ service.message_limit }}</p>
|
||||
{% if not service.active %}
|
||||
<span class="navigation-service-type navigation-service-type--suspended">Suspended</span>
|
||||
{% endif %}
|
||||
|
||||
@@ -93,5 +93,10 @@
|
||||
Only showing the first {{ count_of_displayed_recipients }} rows
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<h2 class="heading-medium">Daily messages remaining: </h2>
|
||||
<p class="govuk-body">{{ remaining_messages }}</p>
|
||||
<h2 class="heading-medium">Remaining messages if sent: </h2>
|
||||
<p class="govuk-body">{{ remaining_messages - count_of_recipients }}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -56,4 +56,11 @@
|
||||
<h2 class="heading-medium">Your file will populate this template ({{ template.name }})</h2>
|
||||
{{ template|string }}
|
||||
|
||||
<div>
|
||||
<h2 class="heading-medium">Daily message limit for this service:</h2>
|
||||
<p class="govuk-body">{{ current_service.name }} - {{ current_service.message_limit }}</p>
|
||||
<h2 class="heading-medium">Daily remaining messages for this service:</h2>
|
||||
<p class="govuk-body">{{ remaining_messages }}</p>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -322,7 +322,7 @@ def test_should_show_back_to_service_if_user_belongs_to_service(
|
||||
):
|
||||
mock_get_service.return_value = service_one
|
||||
expected_page_text = (
|
||||
'Test Service Switch service '
|
||||
'Test Service Daily Message Limit: 50 Switch service '
|
||||
''
|
||||
'Dashboard '
|
||||
'Send messages '
|
||||
|
||||
@@ -1751,7 +1751,7 @@ def test_upload_csvfile_with_valid_phone_shows_all_numbers(
|
||||
assert '202 867 0750' not in page.text
|
||||
assert 'Only showing the first 50 rows' in page.text
|
||||
|
||||
mock_get_notification_count.assert_called_once_with(service_one['id'])
|
||||
mock_get_notification_count.assert_called_with(service_one['id'])
|
||||
|
||||
|
||||
@pytest.mark.parametrize('international_sms_permission, should_allow_international', [
|
||||
|
||||
Reference in New Issue
Block a user