Fix order of steps in send/send test journeys

This fixes the bug where if you have three placeholders:
> ((one)) ((two)) ((three))

The first one you are asked to fill in is `((three))` (ie
`template.placeholders[-1]`).

This reintroduces a bug where if you use the ‘Use my phone number’ link
you skip straight to filling in `((two))` and can never proceed because
you’re never given the chance to fill in `((one))`. This commit also
fixes that bug.
This commit is contained in:
Chris Hill-Scott
2019-06-06 12:24:02 +01:00
parent 7b3d522070
commit 7cc8fcfb2d
2 changed files with 12 additions and 22 deletions

View File

@@ -386,10 +386,7 @@ def send_test_step(service_id, template_id, step_index):
)
try:
if request.endpoint == 'main.send_test_step':
current_placeholder = placeholders[step_index - 1]
else:
current_placeholder = placeholders[step_index]
current_placeholder = placeholders[step_index]
except IndexError:
if all_placeholders_in_session(placeholders):
return get_notification_check_endpoint(service_id, template)
@@ -449,7 +446,7 @@ def send_test_step(service_id, template_id, step_index):
):
skip_link = (
'Use my {}'.format(first_column_headings[template.template_type][0]),
url_for('.send_test_step', service_id=service_id, template_id=template.id, step_index=1),
url_for('.send_test', service_id=service_id, template_id=template.id),
)
else:
skip_link = None