Skip to content

Order selection options#2788

Merged
thomasiles merged 2 commits into
mainfrom
order-selection-options
May 19, 2026
Merged

Order selection options#2788
thomasiles merged 2 commits into
mainfrom
order-selection-options

Conversation

@thomasiles
Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/x0opnWol/3108-order-condition-description-answer-values-based-on-selection-options

In the pagelist view, show routes in the same order as the page's selection options.

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Do the end to end tests need updating before these changes will pass?
  • Has all relevant documentation been updated?

Change the spec for PageListComponent::View#answer_value_groups to
use a stub form and pages, rather than using create.

This is a bit longer but making it more explicit will let us change the
order of the options later. Supplying the selection_options like this
ensures lets us build valid conditions for the page.

Not using create speeds up the tests.
We want to display the conditions for a page on the page list in the
same order as the selection options on the page.

To do this, we get a list of selection options from the page's answer
settings, and then use this list to sort the conditions.

We turn off the filter for the call to `in_order_of` so that any extra
conditions are included, even if they aren't included in the order.

group_by preservers order when given an array so we are safe to use it
like this.

We still sort by the `goto_page_id` so that the conditions are grouped
by the page they go to and nil comes last.
@github-actions
Copy link
Copy Markdown

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2788.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
after 5 minutes, there may be something wrong with the ECS task. You will need to go to the integration AWS account
to debug, or otherwise ask an infrastructure person.

For the sign in details and more information, see the review apps wiki page.

@thomasiles thomasiles marked this pull request as ready for review May 19, 2026 08:21
Copy link
Copy Markdown
Contributor

@SamJamCul SamJamCul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitfy!

@thomasiles thomasiles added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit 96e116e May 19, 2026
4 checks passed
@thomasiles thomasiles deleted the order-selection-options branch May 19, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants