Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP ACRS-186: Custom routing for aggregate 'are you referring a...' pages DO NOT MERGE #136

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jamiecarterHO
Copy link
Contributor

@jamiecarterHO jamiecarterHO commented Jul 10, 2024

What?

Add conditional routing to save-form-session.js behaviour for aggregate intro questions such as 'Are you referring a parent?'.

There are 6 aggregates this caters for: 'Parent', 'Siblings' ('brother or sister'), 'Partner', 'Children', 'Additional family' and 'Family in the UK'.

Added an additional check when attempting to move beyond the summary to make sure the user had not removed all their referred people (have to refer at least one from any referral aggregate). This redirects accordingly to /no-family-referred

Also fixed the reset behaviour for 2 aggregates (partner, family in UK) that should remove aggregated data when 'no' is chosen after people had already been "referred" in that field.

Why?

These are yes/no questions whose condition related to overall form progress and other aggregate form input becomes conditional. For example the onwards navigation is different if the user has come to the page from a main summary 'check your answers' page or whether there was already aggregated data in session or not.

How?

Added a switch statement in save-form-session behaviour to pick up on the current route and then check onward route if it is in the correct cohort for custom routing. If a condition is satisfied, then redirect before HOF manages the next page on its own.

Added two new functions to check the current session and form state and deliver the correct route to nav to. Mainly to keep the body of the exported behaviour tidy.

Testing?

Tested locally. Could do with branch testing before merge to master.

Check list

  • I have reviewed my own pull request for linting issues (e.g. adding new lines)
  • I have written tests (if relevant)
  • I have created a JIRA number for my branch
  • I have created a JIRA number for my commit
  • I have followed the chris beams method for my commit https://cbea.ms/git-commit/
    here is an example commit
  • Ensure drone builds are green especially tests
  • I will squash the commits before merging

@jamiecarterHO jamiecarterHO marked this pull request as draft July 10, 2024 12:21
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.

1 participant