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

Migration to flag sroc supp. billing invoices #2088

Merged
merged 3 commits into from
Mar 31, 2023

Conversation

Cruikshanks
Copy link
Member

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

We had an issue that the current include_in_supplementary_billing flag was added when there was only 1 charge scheme. A licence gets flagged irrespective of whether the change relates to PRESROC or SROC.

Where that has impacted us is when sending a billing batch. When it gets sent it clears the flag for all licences included. But if we cancel one, for example, the PRESROC bill run, and send the SROC one we lose which licences still need to be processed on the PRESROC one.

Our solution was to add a new include_in_sroc_supplementary_billing flag to the licences table and only set it to 'true' when an SROC charge version is approved. That is all now working for new charge versions created and approved.

The remaining issue is existing charge versions that have been processed. When this change goes live there will be some SROC charge versions that have been approved and should be considered. But when they were approved only the include_in_supplementary_billing flag existed.

We could try and do something clever, and look at all the SROC charge versions that have been approved this year and then only set the flag against their connect licences. But we've decided instead to set include_in_sroc_supplementary_billing to true for those licences where include_in_supplementary_billing is true.

It might result in some empty SROC bill runs. But it's far simpler, so there is less chance we'll get something wrong and miss licences.

So, this change adds a migration that will set the flags when first deployed.

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

We had an issue that the current `include_in_supplementary_billing` flag was added at a time there was only 1 charge scheme. A licence gets flagged irrespective of whether the change relates to PRESROC or SROC.

Where that has impacted us is when sending a billing batch. When it gets sent it clears the flag for _all_ licences included. But if we cancel one, for example, the PRESROC bill run, and send the SROC one we lose which licences still need to be processed on the PRESROC one.

[Our solution](#2077) was to add a new `include_in_sroc_supplementary_billing` flag to the `licences` table and only set it to 'true' when an SROC charge version is approved. That is all now working for new charge versions created and approved.

The remaining issue is existing charge versions that have been processed. When this change goes live there will be a number of SROC charge versions that have been approved and should be considered. But when they were approved only the `include_in_supplementary_billing` flag existed.

We could try and do something clever, and look at all the SROC charge versions that have been approved this year and then only set the flag against their connect licences. But we've decided instead to just set `include_in_sroc_supplementary_billing` to true for those licences where `include_in_supplementary_billing` is true.

It might result in some empty SROC bill runs. But it's far simpler, so there is less chance we'll get something wrong and miss licences.

So, this change adds a migration that will set the flags when first deployed.
@Cruikshanks Cruikshanks added the housekeeping Refactoring, tidying up or other work which supports the project label Mar 31, 2023
@Cruikshanks Cruikshanks self-assigned this Mar 31, 2023
@Cruikshanks Cruikshanks marked this pull request as ready for review March 31, 2023 08:03
@Cruikshanks Cruikshanks merged commit 9c0c432 into main Mar 31, 2023
@Cruikshanks Cruikshanks deleted the migration-flag-sroc-supplementary-invoices branch March 31, 2023 08:04
Cruikshanks added a commit that referenced this pull request May 16, 2023
When we made the change [Migration to flag sroc supp. billing invoices](#2088) we just assumed that all licences by now would have an SROC charge version. In testing we have found there are licences

- with only PRESROC charge versions
- with no charge versions at all!

This means our premise that the flags would be cleared once a bill run has been ran is invalid. For some licences they will never be cleared! 🤦

So, we're adding this migration to clean up our mess. It will unflag any licence flagged for SROC supplementary that doesn't have at least 1 charge version with a start date >= 2022-04-01.
Cruikshanks added a commit that referenced this pull request May 17, 2023
When we made the change [Migration to flag sroc supp. billing invoices](#2088) we just assumed that all licences by now would have an SROC charge version. In testing, we have found there are licences

- with only PRESROC charge versions
- with no charge versions at all!

This means our premise that the flags would be cleared once a bill run has been run is invalid. Some licences will never be cleared! 🤦

So, we're adding this migration to clean up our mess. It will unflag any licence flagged for SROC supplementary that doesn't have at least 1 charge version with a start date >= 2022-04-01.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Refactoring, tidying up or other work which supports the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant