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

Fetching the charge versions data #15

Merged
merged 9 commits into from
Nov 10, 2022
Merged

Fetching the charge versions data #15

merged 9 commits into from
Nov 10, 2022

Conversation

Beckyrose200
Copy link
Contributor

@Beckyrose200 Beckyrose200 added the enhancement New feature or request label Nov 3, 2022
@Beckyrose200 Beckyrose200 self-assigned this Nov 3, 2022
Jozzey added a commit that referenced this pull request Nov 9, 2022
https://eaflood.atlassian.net/browse/WATER-3787

Some migrations scripts are required to create the tables/data for the unit tests in this PR #15 in order for the build process to pass.

As no migrations process had yet been set up on this application. This PR has been created to build the migrations process as well as populate the test database with the data required for the PR mentioned above.

This migration process has been based on that used by the [Charging Module](https://github.com/DEFRA/sroc-charging-module-api).
@Jozzey Jozzey marked this pull request as ready for review November 9, 2022 16:32
@Beckyrose200 Beckyrose200 merged commit 3e339ba into main Nov 10, 2022
@Beckyrose200 Beckyrose200 deleted the fetch-cv-data branch November 10, 2022 11:20
Cruikshanks added a commit that referenced this pull request Nov 11, 2022
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.
Cruikshanks added a commit that referenced this pull request Nov 15, 2022
https://eaflood.atlassian.net/browse/WATER-3787

In [Fetching the charge versions data](#15) 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.

In this change, we are starting to filter the charge versions by

- are they linked to a licence that has been marked `include_in_supplementary_billing`
- are they 'current', which we have determined by whether `end_date` is populated (because `status` doesn't work)

** Notes

- Add migrations for 'water.licences' and 'water.charge_versions' tables

The `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.

- Expand the test data helper support

We add a new `LicenceHelper` as our query now needs these linked to charge versions. Rather than have our tests repeatedly set this up we have 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, we go with some defaults.

We thought we might need a `RegionHelper` so added that as well. Turns out we didn't, but we expect to in the future so left it in.

Co-authored-by: Jason Claxton <[email protected]>
Co-authored-by: Stuart Adair <[email protected]>
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