-
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
Add new NoBillingPeriodsError as a reminder #1257
Merged
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-4403 As part of the work to add support for SROC two-part tariff bill runs to the service we needed to amend the set up bill run journey. We took this opportunity to rewrite it! This meant copying some of the existing restrictions, one of which being that you cannot generate a supplementary until the annual has been created and sent. We then also replaced the legacy SROC annual with a new engine which was much more performant and reliable. Because of this the billing & data team were able to bring forward the month they generate the bill runs in. However, that block on running supplementary meant until they are ready to generate the annual bill run each year, meant they are still blocked from being able to generate bills during that period. So, we were asked to make a tweak to our version, that would allow them to generate a supplementary event when the annual has not yet been done. The old logic for supplementary always took the current financial year as the start point. The new logic we implemented works by finding the last annual bill run for a region, and using it's year. Already run the annual bill run? Then the result would be the current financial year. Not yet run it? Then we'll find last years and start from there. That is however, when working in pre-prod or production where there is a complete history of annual bill runs. Working locally, or perhaps in `dev` or `tst` you may find the last annual was in 2021, or simply doesn't exist at all! When this happens the SROC engine is unable to determine the billing periods for the supplementary bill run being requested and an error is thrown. At the time coding to handle this situation 'gracefully' was discussed but rejected. We'd be writing code and building screens for a situation that could _never_ happen in production. The problem is every now and again we forget this. We then attempt to create a supplementary in one of these non-production environments and start panicking when it appears broken. This is a 'low-fi' attempt to try and remind us devs _why_ supplementary may appear to be broken. 😁
Cruikshanks
requested review from
robertparkinson,
sujithvg,
Jozzey,
jonathangoulding,
Beckyrose200 and
rvsiyad
August 15, 2024 09:01
Beckyrose200
approved these changes
Aug 15, 2024
robertparkinson
approved these changes
Aug 15, 2024
Jozzey
approved these changes
Aug 15, 2024
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.
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-4403
As part of the work to add support for SROC two-part tariff bill runs to the service, we needed to amend the set-up bill run journey. We took this opportunity to rewrite it!
This meant copying some of the existing restrictions, one of which being that you cannot generate a supplementary until the annual has been created and sent.
We then replaced the legacy SROC annual with a new engine, which was much more performant and reliable. Because of this, the billing & data team was able to bring forward the month they generated the bill runs in.
However, they are still blocked from running supplementary until they are ready to generate the annual bill run each year.
So, we were asked to tweak our version, allowing them to generate a supplementary bill run even when the annual has not yet been done.
The old logic for supplementary always took the current financial year as the starting point. The new logic we implemented works by finding the last annual bill run for a region and using its year.
Already run the annual bill? Then, the result would be the current financial year. Not yet run it? Then we'll find last year's and start from there.
That is, however, when working in pre-prod or production where there is a complete history of annual bill runs. Working locally, or perhaps in
dev
ortst
, you may find the last annual was in 2021 or simply doesn't exist at all!When this happens, the SROC engine is unable to determine the billing periods for the supplementary bill run being requested, and an error is thrown. At the time, coding to handle this situation 'gracefully' was discussed but rejected. We'd be writing code and building screens for a situation that could never happen in production.
The problem is that we forget this every now and again. We then attempt to create a supplementary in one of these non-production environments and start panicking when it appears broken.
This is a 'low-fi' attempt to try and remind us devs why supplementary may appear to be broken. 😁