Clean up return reqs. linked to due return logs #1041
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://eaflood.atlassian.net/browse/WATER-4656
Having made return versions and requirements visible to our internal users, they have noticed that there are return requirements displayed in WRLS that don't exist.
We know why this is: NALD allows users to delete records. This means a user can create a record in NALD on day 1; we'll see and import the record that night. They can then delete the record (in most cases, it is because a mistake was spotted) on day 2. The import never deletes records, so the errant return requirement remains.
With us taking over management of return requirements, it has become important to try to get the two systems in sync as much as possible before the import is switched off.
This change builds on the work done in Add return requirements clean-up step to import. It added the job and the script to remove return requirements that no longer exist in NALD and were not linked to any return logs.
We then moved on to Clean up return reqs. linked to void return logs. This final change adds the query to delete any return requirements that no longer exist in NALD and are only linked to
due
return logs.