Add configuration for describing none of the above for selection questions#2428
Conversation
23c48f4 to
a9673b9
Compare
6eb532c to
d7be5a1
Compare
|
Content all looks good! |
ec9eb82 to
b338bc4
Compare
thomasiles
left a comment
There was a problem hiding this comment.
this is great and covers loads of cases I wouldn't have even thought of. It works well testing locally 🏅
We want to display different text on the page to configure the 'None of the above' question depending on whether there are fewer or more than 30 options. In the case of having more than 30 options an autocomplete component will be shown in forms-runner for the selection question, and the additional question for 'None of the above' will be shown on a separate page. This helper method will be used in the template to decide which text to show.
Add a route, controller and view for configuring the question text and
whether the input is optional for the "None of the above" option for
selection questions.
This page is shown after the page to add selection options, if the
"Yes, and let people provide a different answer" option is selected
for "Should the list include an option for ‘None of the above’?"
If enabled, we will show a new option on the selection options page for a 'Selection from a list of options' question type to allow users to provide a different answer if they select 'None of the above'.
Move duplicated code to the base class.
Reduce duplication between options_input_spec and base_options_input_spec by using shared examples
Make it so that users can select "Yes, and let people provide a different answer" for "Should the list include an option for 'None of the above'?". Only show this option if the feature flag is enabled. If either "Yes" or "No" are selected, delete the existing `none_of_the_above_question` configuration from the DraftQuestion if it exists.
If the question previously had configuration for users to provide another answer when "None of the above" was selected, but the answer for "Should the list include an option for ‘None of the above’?" has been changed so that we will no longer ask users to provide another answer - delete the `none_of_the_above_question` from the `answer_settings` for the draft question.
When the back button is clicked on the page to configure the none of the above question, we want to make sure the correct option for whether to include none of the above is selected. To acheive this, when the selection options page is submitted, as well as setting `is_optional` based on the selected option, also set `none_of_the_above_question` to be an empty array in the answer_settings so we can use this to determine that the "Yes, and let people provide a different answer" option was selected.
If the user selects "Yes, and let people provide a different answer" for "Should the list include an option for ‘None of the above’?" on either the page to add individual selection options or the page to bulk-add the options in a text box, redirect them to the page to configure the question for the None of the above option.
If "Yes, and let people provide a different answer" was selected for "Should the list include an option for ‘None of the above’?", show the question that will be asked on the edit question page with a link to change it. If the question is optional, show " (optional)" after the question.
To be more consistent with how we usually do updates, move updating the page when submitting the edit question page to the `submit` method on the QuestionInput. Previously we would have wanted this to be in the controller as it was calling forms-api using ActiveResource. But now the Page is updated in the local database instead. Improve the tests around this.
This is to handle the case when a user clicks the "Change" link on the edit question page for a selection question and changes their answer for "Should the list include an option for ‘None of the above’?" to "Yes, and let people provide a different answer" but then clicks back without entering a question text. In this case, when they come to save their question, remove the blank hash for none_of_the_above_question in the answer_settings. Form fillers will be shown a "None of the above" option with no question in this case.
b338bc4 to
86a07a6
Compare
|
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2428.admin.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |



What problem does this pull request solve?
Trello card: https://trello.com/c/US6RcfTG
This adds the option "Yes, and let people provide a different answer" for "Should the list include an option for ‘None of the above’?" for selection questions and displays a page to configure the question users will be asked if this is selected.
Things to consider when reviewing