-
Notifications
You must be signed in to change notification settings - Fork 0
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
Select SROC supplementary charge versions for real #27
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://eaflood.atlassian.net/browse/WATER-3787 In [Fetching the charge versions data](#15) we added a new service to start selecting scharge versions to be included in the Supplementary Bill run. But at the moment, it's only filter is all charge versions with the `scheme` SROC. We have test data and scenarios to work with so we can now start implementing the filter 'for real'. This is the start of the process. We expect it's likely we'll be finessing the filter in subsequent PR's. But this gets the ball rolling.
It turns out the oft-mentioned `include_in_supplementary_billing` flag is in the `licences` table and not the `charge_versions` table. This means we can't just rely on checking the charge versions table and will need to build a licences table for our testing. We also add a migration to add `licence_id` and `end_date` fields to the charge versions table. `licence_id` is how the 2 tables are linked and `end_date` is what we are having to rely on to determine the 'current' charge version.
Two changes here. First me re-ordered the method calls and swapped some out for other aliases in order for the query to read more like traditional SQL. The second is that we have updated it to take into account the `include_in_supplementary_billing` flag on the licences table. This is the main driver of whether to include something in supplementary billing. “Simple”, was our next thought. Charge versions have a `scheme` and a `status` column; we'll just grab the one where `scheme=sroc && status=current` for each licence flagged for supplementary billing. That was until our initial tests showed that `status` is not getting set correctly. This means we have multiple SROC charge versions both with a status of `current`. Fortunately, it looks like `end_date` is getting set as expected, which means we have a way of selecting them (for now!)
We add a new `LicenceHelper` as our query now needs these linked to charge versions. Rather than have our test have to repeatedly set up this up we expand our data helpers. First part of this is having the charge version helper automatically call the licence helper and manage linking the 2 records. Adding the licence also means we need to start passing a bunch of data around now. So, instead we go with some defaults. We'll add some documentation to make this more visible in subsequent commits.
With the updated query in the service we needed to update our tests to setup the appropriate environments. We've expanded the functionality of our data helpers. So, we take advantage of them to update and expand the tests we have for this service.
Cruikshanks
force-pushed
the
select-sroc-sup-charge-versions
branch
from
November 13, 2022 22:38
8ff4104
to
d749826
Compare
Jozzey
previously approved these changes
Nov 15, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StuAA78
requested changes
Nov 15, 2022
Co-authored-by: Stuart Adair <[email protected]>
Co-authored-by: Stuart Adair <[email protected]>
Co-authored-by: Stuart Adair <[email protected]>
StuAA78
approved these changes
Nov 15, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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-3787
In Fetching the charge versions data we added a new service to start selecting charge versions to be included in the Supplementary Bill run.
But at the moment, its only filter is all charge versions with the
scheme
SROC. We have test data and scenarios to work with so we can now start implementing the filter 'for real'.This is the start of the process. We expect it's likely we'll be finessing the filter in subsequent PRs. But this gets the ball rolling.