-
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
Refactor Supplementary output to test presenter #32
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
Jozzey
previously approved these changes
Nov 22, 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.
👍🏼
https://eaflood.atlassian.net/browse/WATER-3787 https://eaflood.atlassian.net/browse/WATER-3802 https://eaflood.atlassian.net/browse/WATER-3826 We're trying to make it easy to test that we are selecting the right values from the DB when generating the SROC supplementary bill run. Our test endpoint currently list the charge versions, which includes the licence reference. In [Add new SROC Billing Period service](#30) we add the financial years. But it would be easier to validate the licences that have been selected if the response included a unique list of them rather than having to searching through the charge version results. This gives us a prime opportunity to split out the presentation logic from what the service is doing, especially as it is likely to be discarded when we are happy the process is working. So, in this change we move formatting the response to a new 'presenter'. As part of the change we'll add a unique list of the Licences being used.
This is copying what the `SupplementaryService` is doing with the result.
We are going to amend the query to return more fields. But those fields will clash if we don't specify which table they come from. This is likely to explode the query as we have to prefix every field name. If you were writing raw SQL, you'd alias the table names to avoid this. Knex allows us to do the same so we take advantage of this feature.
Again, we're updating the functionality to mirror what we are currently expecting. But we're almost ready to start expanding what the service appears to return.
Now we include the scheme and end date in the results
Cruikshanks
force-pushed
the
refactor-to-test-presenter
branch
from
November 23, 2022 14:15
fa57b84
to
fe05de7
Compare
Jozzey
approved these changes
Nov 23, 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.
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
https://eaflood.atlassian.net/browse/WATER-3802
https://eaflood.atlassian.net/browse/WATER-3826
We're trying to make it easy to test that we are selecting the right values from the DB when generating the SROC supplementary bill run. Our test endpoint currently lists the charge versions, which includes the licence reference. In Add new SROC Billing Period service we add the financial years.
But it would be easier to validate the licences that have been selected if the response included a unique list of them rather than having to search through the charge version results. This gives us a prime opportunity to split out the presentation logic from what the service is doing, especially as it is likely to be discarded when we are happy the process is working.
So, in this change, we move formatting the response to a new 'presenter'. As part of the change, we'll add a unique list of the Licences being used.
Example response following this change