Handle precompiled via in returned letters list

Precompiled letters sent via the API don’t have:
- a template
- a filename

Which means in the list of returned letters we just show ‘None’. This
commit changes this to ‘Provided as PDF’, which is how we talk about
precompiled letters elsewhere (for example in the template statistics on
the dashboard).
This commit is contained in:
Chris Hill-Scott
2020-01-02 11:29:41 +00:00
parent f0fe532b46
commit 5ea02119f4
2 changed files with 3 additions and 1 deletions

View File

@@ -28,7 +28,7 @@
field_headings_visible=False
) %}
{% call field() %}
<span class="file-list-filename file-list-filename-unlinked">{{ item.template_name or item.uploaded_letter_file_name }}</span>
<span class="file-list-filename file-list-filename-unlinked">{{ item.template_name or item.uploaded_letter_file_name or 'Provided as PDF' }}</span>
<span class="file-list-hint">
{% if item.client_reference %}
Reference {{ item.client_reference }}

View File

@@ -75,6 +75,7 @@ def test_returned_letters_page(
(None, 'Example template', None, None),
('DEF456', None, None, 'Example precompiled.pdf'),
(None, None, None, 'Example one-off.pdf'),
('XYZ999', None, None, None),
)
]
mocker.patch('app.service_api_client.get_returned_letters', return_value=data)
@@ -92,6 +93,7 @@ def test_returned_letters_page(
'Example template No reference provided Originally sent 24 December 2019',
'Example precompiled.pdf Reference DEF456 Originally sent 24 December 2019',
'Example one-off.pdf No reference provided Originally sent 24 December 2019',
'Provided as PDF Reference XYZ999 Originally sent 24 December 2019',
] == [
normalize_spaces(row.text) for row in page.select('tr')
]