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

Match returns to charge version by purpose type #342

Merged
merged 3 commits into from
Aug 8, 2023

Conversation

Cruikshanks
Copy link
Member

@Cruikshanks Cruikshanks commented Aug 8, 2023

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

We are now working on Example 2, a licence with a charge version with 4 elements. One has a single purpose. The other has an element with 3 purposes. We need to match 4 returns; 1 to the first element and the rest to the second.

This change links the charge purposes to returns via water.purposes_uses, specifically legacy_id to metadata.purposes[0].tertiary.code. It's this that allows us to match a return directly to a charge element.

We also realised that we were still assigning the returns at the wrong level. They needed to be assigned to the charge element they match not the charge version.

Finally, we spotted the innerJoin() in our _fetchChargeVersions() query was causing a charge version to appear more than once if it contained multiple charge elements.

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

We are now working on Example 2, a licence with 2 charge versions. One has 1 element and the other has 3. We need to match the 4 returns accordingly.

This change updates our returns query to take into account the purpose type to improve the matching and complete this example scenario.
@Cruikshanks Cruikshanks added the enhancement New feature or request label Aug 8, 2023
@Cruikshanks Cruikshanks self-assigned this Aug 8, 2023
All works but need to agree that is the case in the mob! Stopping for lunch
Confirmed as working. We just spotted some tidying up we could do.
@Cruikshanks Cruikshanks marked this pull request as ready for review August 8, 2023 14:12
@Cruikshanks Cruikshanks merged commit c55dd5f into main Aug 8, 2023
@Cruikshanks Cruikshanks deleted the match-returns-by-type branch August 8, 2023 14: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.

1 participant