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

Add copy existing rtn req. option to setup journey #1081

Merged
merged 7 commits into from
Jun 7, 2024

Conversation

Cruikshanks
Copy link
Member

@Cruikshanks Cruikshanks commented Jun 6, 2024

https://eaflood.atlassian.net/browse/WATER-4355

Part of the work to replace NALD for handling return requirements

We want to be able to offer users the option to copy data from an existing return requirement when setting up a new one. However, the option must only appear if one exists to copy.

This change adds the logic to check for existing returns and the option to the "How do you want to set up the returns" page.


Note about where we fetch the return versions

We're already fetching a bunch of data for the licence during the initiate process. We could have built a service to confirm if return versions exist for a licence. This would then need to be called in the Setup and SubmitSetup services.

But then we'd need another service to actually fetch details for each version in order to have something to display to the user. Of course, the fetch service could support both functions. But then we're fetching the same data twice, but using it only once.

Fetching and storing it at this point means we make the call once and then it is always available. There is a chance it isn't used, for example, if the user bails early or selects a different path. But we think this solution is the simplest and easiest to maintain out of the options.

https://eaflood.atlassian.net/browse/WATER-4355

> Part of the work to replace NALD for handling return requirements

We want to be able to offer users the option to copy data from an existing return requirement when setting up a new one. However, the option must only appear if one exists to copy.

This change adds the logic to check for existing returns and the option to the "How do you want to set up the returns" page.
@Cruikshanks Cruikshanks added the enhancement New feature or request label Jun 6, 2024
@Cruikshanks Cruikshanks self-assigned this Jun 6, 2024
We're already fetching a bunch of data for the licence during the initiate process. We could have built a service to confirm if return versions exist for a licence. This would then need to be called in the `Setup` and `SubmitSetup` services.

But then we'd need another service to actually fetch details for each version in order to have something to display to the user. Of course, this service could support both functions. But then we're fetching the same data twice, but using it only once.

Fetching and storing it at this point means we make the call once and then it is always available. There is a chance it isn't used, for example the user bails early or selects a different path. But we think this solution is the simplest and easiest to maintain out of the options.
Using this we can determine whether to show the option or not
Make sure we don't reject the value as invalid!
@Cruikshanks Cruikshanks marked this pull request as ready for review June 7, 2024 16:11
@Cruikshanks Cruikshanks merged commit bd7b846 into main Jun 7, 2024
6 checks passed
@Cruikshanks Cruikshanks deleted the copy-an-existing-return-requirement branch June 7, 2024 16:13
Cruikshanks added a commit that referenced this pull request Jun 7, 2024
SHould really have been done in [Add copy existing rtn req. option to setup journey](#1081) 😬😳
Cruikshanks added a commit that referenced this pull request Jun 9, 2024
SHould really have been done in [Add copy existing rtn req. option to setup journey](#1081) 😬😳
Cruikshanks added a commit that referenced this pull request Jun 10, 2024
SHould really have been done in [Add copy existing rtn req. option to setup journey](#1081) 😬😳
Cruikshanks pushed a commit that referenced this pull request Jun 10, 2024
https://eaflood.atlassian.net/browse/WATER-4283

> Part of the work to replace NALD for handling return requirements

We want to be able to offer users the option to copy data from an existing return requirement when setting up a new one. We [made the option available](#1081) in the `/setup` page.

When a user selects this option they'll be taken to the `Select an existing return requirement from` page. This change is about completing that page and the feature.

- add the controls to the page. These will be dynamically generated based on the licences current return versions
- add validation to the page
- retrieve the requirements for the selected return version and populate the session with them

Once the page has completed it's work the user will be redirected to the `/check` page where they can see the results of their action.
Cruikshanks added a commit that referenced this pull request Jun 10, 2024
https://eaflood.atlassian.net/browse/WATER-4283

> Part of the work to replace NALD for handling return requirements

We want to be able to offer users the option to copy data from an existing return requirement when setting up a new one. We [made the option available](#1081) in the `/setup` page.

We then implemented the logic to fetch the existing data and transform it into a something that can be stored in the session for later persisting back as a new record.

One of the new features we're enabling with our takeover is the ability to record where a return requirement is _not_ needed. Our new journey allows for this.

When this happens though, we'll need to persist a return version to record it. It will be 'current' but it will have no return requirements linked to it.

Because of this we need to tweak the query which fetches which return versions can be copied from to exclude those without any return requirements.
Cruikshanks added a commit that referenced this pull request Jun 10, 2024
https://eaflood.atlassian.net/browse/WATER-4283

> Part of the work to replace NALD for handling return requirements

We want to be able to offer users the option to copy data from an existing return requirement when setting up a new one. We [made the option available](#1081) in the `/setup` page.

We then implemented the logic to fetch the existing data and transform it into something that can be stored in the session for later persisting as a new record.

One of the new features we're enabling with our takeover is the ability to record where a return requirement is _not_ needed. Our new journey allows for this.

When this happens, though, we'll need to persist a return version to record it. It will be 'current' but it will have no return requirements linked to it.

Because of this, we need to tweak the query that fetches which return versions can be copied from to exclude those without any return requirements.
Cruikshanks added a commit that referenced this pull request Jun 12, 2024
https://eaflood.atlassian.net/browse/WATER-4283

> Part of the work to replace NALD for handling return requirements

We want to be able to offer users the option to copy data from an existing return requirement when setting up a new one. We [made the option available](#1081) in the `/setup` page.

We then did the actual work of allowing users to select the return requirements to copy and saving them to the session in [Complete Select existing return requirement page](#895).

But we've since learnt that the title we used for the page is not right. This change corrects it.
Cruikshanks added a commit that referenced this pull request Jun 12, 2024
https://eaflood.atlassian.net/browse/WATER-4283

> Part of the work to replace NALD for handling return requirements

We want to be able to offer users the option to copy data from an existing return requirement when setting up a new one. We [made the option available](#1081) in the `/setup` page.

We then did the actual work of allowing users to select the return requirements to copy and saving them to the session in [Complete Select existing return requirement page](#895).

But we've since learned that the title we used for the page is not right. This change corrects it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant