Fix display of financial year in new bill views #523
Merged
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-4131
In testing the new bill views, it has been spotted that it looked like we were displaying the financial year incorrectly.
In a bill's metadata, we show, for example, "Financial year 2023-2024". The financial year is from 1st April to 31st March hence we represent the year being
[from] and [to]
. Our QA however spotted examples where we were showing "2019 to 201".We were getting the financial years from the bill run and assumed the legacy code was doing the same. When we checked we found it was getting a financial year ending but then just taking 1 away from it directly in the view to get the from value.
"Shame!" we cried. "Another example of shoddy work!" Only it wasn't. 😳😬
The values we were using are
from_financial_year_ending
andto_financial_year_ending
. We had incorrectly assumed they were the from and to years for bill run. Instead, they are to record financial years covered by a bill run. A supplementary can cover 6 years. So, for example, if a PRESROC supplementary bill run covered 2018-04-01 to 2022-03-31 the DB would holdfrom_financial_year_ending = 2019, to_financial_year_ending = 2022
.As we are now displaying the bill, the value we need is
financial_year_ending
in the bill record. And as we only have the ending we need to do something similar to the legacy code and deduct 1 year to get the 'from'.This change fixes what we have built to do just that.