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

Amend ChargeReferenceModel for PRESROC #502

Merged
merged 6 commits into from
Nov 6, 2023

Conversation

Cruikshanks
Copy link
Member

@Cruikshanks Cruikshanks commented Nov 6, 2023

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

Related to WATER-4155 and the work to replace the legacy bill page with our own we're now starting to build the page it will link to; a view of the bill licence and all its transactions.

We are adding a new fetch bill licence service that will return data for both SROC and PRESROC transactions. Unfortunately, the previous team chose to store data related to the transactions differently. This means depending on what scheme a transaction is linked to you need to pull information from different places.

To support this we need to make a tweak to our ChargeReferenceModel. Under SROC a charge reference has multiple charge elements which in turn have multiple charge purposes. These purposes then link to a PurposeModel.

Under PRESROC the charge reference is actually a charge element (hence the table name is charge_elements) and directly links to a PurposeModel.

So, this change updates the ChargeReferenceModel so that it can pull through the linked purpose should one exist.

We also update the PurposeModel with the new relationship. Note, whilst doing this we spotted that the existing relationship to charge elements was wrong. It should be a HasManyRelation so we also use this opportunity to fix it.

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

Related to WATER-4155 and the work to replace the legacy bill page with our own we're now starting to build the page it will link to; a view of the bill licence and all its transactions.

We are adding a [new fetch bill licence service](#501) that will return data for both SROC and PRESROC transactions. Unfortunately, the previous team chose to store data related to the transactions differently. This means depending on what scheme a transaction is linked to you need to pull information from different places.

To support this we need to make a tweak to our `ChargeReferenceModel`. Under SROC a charge reference has multiple charge elements which in turn have multiple charge purposes. These purposes then link to a `PurposeModel`.

Under PRESROC the charge reference is _actually_ a charge element (hence the table name is `charge_elements`) and directly links to a `PurposeModel`.

So, this change updates the ChargeReferenceModel so that it _can_ pull through the linked purpose should one exist.
@Cruikshanks Cruikshanks added the housekeeping Refactoring, tidying up or other work which supports the project label Nov 6, 2023
@Cruikshanks Cruikshanks self-assigned this Nov 6, 2023
Should be a 'HasManyRelation' like charge references.
Our test charge_elements table does not feature a `purpose_use_id` column.
@Cruikshanks Cruikshanks marked this pull request as ready for review November 6, 2023 10:09
Copy link
Contributor

@Jozzey Jozzey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@Cruikshanks Cruikshanks merged commit b03a4aa into main Nov 6, 2023
6 checks passed
@Cruikshanks Cruikshanks deleted the amend-charge-reference-for-presroc branch November 6, 2023 16:18
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.

2 participants