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

Update existing return versions when a new one is added #1216

Merged
merged 27 commits into from
Aug 9, 2024

Conversation

Jozzey
Copy link
Contributor

@Jozzey Jozzey commented Jul 31, 2024

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

Having worked out how to convert the information in the return requirements setup session into the various records in the DB (see #1137) we now need to deal with how the new record impacts the existing ones.

This PR will extend the persisting logic to deal with changes to the existing return versions.

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

Having worked out how to convert the information in the return requirements setup session into the various records in the DB (see #1137) we now need to deal with how the new record impacts the existing ones.

This PR will extend the persisting logic to deal with changes to the existing return versions.
@Jozzey Jozzey added the enhancement New feature or request label Jul 31, 2024
@Jozzey Jozzey self-assigned this Jul 31, 2024
@Jozzey Jozzey marked this pull request as ready for review August 6, 2024 17:41
@Jozzey Jozzey requested a review from Cruikshanks August 6, 2024 17:41
Cruikshanks added a commit that referenced this pull request Aug 8, 2024
https://eaflood.atlassian.net/browse/WATER-4568

A couple of suggested alternative solutions to the one presented in [Update existing return versions when a new one is added](#1216).

1. It avoids the need to first extract _all_ return versions and then identify which previous versions to update 'in code'. The checks are done within the queries sent to the database. In most cases a single query will be fired at the database. But there is a possibility of making 4 calls to the database

2. As currently it extracts _all_ return versions from the database and then identifies which version to update 'in code'. But it breaks the work down rather than doing it all in one large method.
Jozzey and others added 3 commits August 9, 2024 12:19
`match` was an instance of `ReturnVersionModel`. So, we don't need to generate another patch query, we can just tell the instance to patch itself!
@Jozzey Jozzey merged commit 927a1d7 into main Aug 9, 2024
6 checks passed
@Jozzey Jozzey deleted the update-existing-return-versions branch August 9, 2024 13:18
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.

2 participants