mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-27 09:29:22 -04:00
- Remove the trailing comma from the first line of the "to" field
- Add client_reference to the activity CSV report - Show the recipient on the CSV report the same way as the view activity page.
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
{% if item.status in ('pending-virus-check', 'virus-scan-failed') %}
|
||||
<span class="file-list-filename loading-indicator">Checking</span>
|
||||
{% else %}
|
||||
<a class="file-list-filename" href="{{ url_for('.view_notification', service_id=current_service.id, notification_id=item.id) }}">{{ item.to.splitlines()[0] }}</a>
|
||||
<a class="file-list-filename" href="{{ url_for('.view_notification', service_id=current_service.id, notification_id=item.id) }}">{{ item.to.splitlines()[0].lstrip().rstrip(' ,') }}</a>
|
||||
{% endif %}
|
||||
<p class="file-list-hint">
|
||||
{{ item.preview_of_content }}
|
||||
|
||||
@@ -165,7 +165,7 @@ def generate_notifications_csv(**kwargs):
|
||||
original_column_headers = original_upload.column_headers
|
||||
fieldnames = ['Row number'] + original_column_headers + ['Template', 'Type', 'Job', 'Status', 'Time']
|
||||
else:
|
||||
fieldnames = ['Recipient', 'Template', 'Type', 'Sent by', 'Sent by email', 'Job', 'Status', 'Time']
|
||||
fieldnames = ['Recipient', 'Reference', 'Template', 'Type', 'Sent by', 'Sent by email', 'Job', 'Status', 'Time']
|
||||
|
||||
yield ','.join(fieldnames) + '\n'
|
||||
|
||||
@@ -187,7 +187,9 @@ def generate_notifications_csv(**kwargs):
|
||||
]
|
||||
else:
|
||||
values = [
|
||||
notification['recipient'],
|
||||
# the recipient for precompiled letters is the full address block
|
||||
notification['recipient'].splitlines()[0].lstrip().rstrip(' ,'),
|
||||
notification['client_reference'],
|
||||
notification['template_name'],
|
||||
notification['template_type'],
|
||||
notification['created_by_name'] or '',
|
||||
|
||||
@@ -55,6 +55,7 @@ def _get_notifications_csv(
|
||||
"row_number": row_number + i,
|
||||
"to": recipient,
|
||||
"recipient": recipient,
|
||||
"client_reference": 'ref 1234',
|
||||
"template_name": template_name,
|
||||
"template_type": template_type,
|
||||
"template": {"name": template_name, "template_type": template_type},
|
||||
@@ -160,14 +161,14 @@ def test_spreadsheet_checks_for_bad_arguments(args, kwargs):
|
||||
@pytest.mark.parametrize('created_by_name, expected_content', [
|
||||
(
|
||||
None, [
|
||||
'Recipient,Template,Type,Sent by,Sent by email,Job,Status,Time\n',
|
||||
'foo@bar.com,foo,sms,,sender@email.gov.uk,,Delivered,1943-04-19 12:00:00\r\n',
|
||||
'Recipient,Reference,Template,Type,Sent by,Sent by email,Job,Status,Time\n',
|
||||
'foo@bar.com,ref 1234,foo,sms,,sender@email.gov.uk,,Delivered,1943-04-19 12:00:00\r\n',
|
||||
]
|
||||
),
|
||||
(
|
||||
'Anne Example', [
|
||||
'Recipient,Template,Type,Sent by,Sent by email,Job,Status,Time\n',
|
||||
'foo@bar.com,foo,sms,Anne Example,sender@email.gov.uk,,Delivered,1943-04-19 12:00:00\r\n',
|
||||
'Recipient,Reference,Template,Type,Sent by,Sent by email,Job,Status,Time\n',
|
||||
'foo@bar.com,ref 1234,foo,sms,Anne Example,sender@email.gov.uk,,Delivered,1943-04-19 12:00:00\r\n',
|
||||
]
|
||||
),
|
||||
])
|
||||
@@ -183,7 +184,7 @@ def test_generate_notifications_csv_without_job(
|
||||
created_by_name=created_by_name,
|
||||
created_by_email_address="sender@email.gov.uk",
|
||||
job_id=None,
|
||||
job_name=None,
|
||||
job_name=None
|
||||
)
|
||||
)
|
||||
assert list(generate_notifications_csv(service_id=fake_uuid)) == expected_content
|
||||
|
||||
Reference in New Issue
Block a user