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

Cleanup licence data removed from NALD #1047

Merged
merged 17 commits into from
Dec 9, 2024
Merged

Conversation

Jozzey
Copy link
Contributor

@Jozzey Jozzey commented Nov 28, 2024

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

Following a requirements analysis meeting on November 21st, we need to update the queries we have written to remove licence data from WRLS that no longer exists in NALD.

A PR that deals with the scenario where the licence record has been removed from NALD has already been completed in PR #1044

This PR will focus on the child records of the licence that may have been removed from NALD while the licence remains. The exception to this would be a licence that has been removed from NALD but has not been removed from WRLS as it has been involved in a bill run, has a return version, or is linked to an external entity.

The individual tickets covered by this PR are:

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

Following a requirements analysis meeting on the 21st November we need to make some updates to the queries we have written to remove licence data from WRLS that no longer exists in NALD.

A PR that deals with the scenario where the licence record has been removed from NALD has already been completed in PR #1044

This PR will be focussing on the child records of the licence that may have been removed from NALD whilst the licence still remains. The exception to this would be a licence that has been removed from NALD but has not been removed from WRLS as it has been involved in a bill run, has a return version, or is linked to an external entity.

The individual tickets covered by this PR are:
- https://eaflood.atlassian.net/browse/WATER-4751
@Jozzey Jozzey added the enhancement New feature or request label Nov 28, 2024
@Jozzey Jozzey self-assigned this Nov 28, 2024
This query will delete any soft deleted licence monitoring stations linked to deleted NALD licence version purpose conditions
At this point in the process the only monitoring stations remaining are ones which should not be removed. As they can't be removed that means that the purpose will also not be removed.

Because the purpose cannot be removed (even if it has been removed from NALD) it will need at least 1 point to be a valid record. Therefore the point is not deleted. This is because if there were 2 points on the purpose both could also have been deleted from NALD if the purpose was removed. This would make it pretty much impossible to determine which point may need to be kept if there are more than one. Therefore no point gets deleted.

The same applies to the purpose if its associated licence cannot be deleted for reasons.
@Jozzey
Copy link
Contributor Author

Jozzey commented Dec 5, 2024

SonarCloud is complaining about the test coverage after I moved some of the queries out of the main handler function into their own private functions. As the queries were not previously tested, I'm not planning on adding new tests to this legacy code.

@Jozzey Jozzey requested a review from Cruikshanks December 5, 2024 15:03
@Jozzey Jozzey marked this pull request as ready for review December 5, 2024 15:03
@Jozzey Jozzey marked this pull request as draft December 5, 2024 15:36
@Jozzey Jozzey marked this pull request as ready for review December 5, 2024 15:41
@Jozzey Jozzey merged commit 131e185 into main Dec 9, 2024
4 of 5 checks passed
@Jozzey Jozzey deleted the cleanup-nald-licence-data branch December 9, 2024 09:38
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