-
Notifications
You must be signed in to change notification settings - Fork 7
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
AP-3563/AP-5496: Standardise currency handling across the app #7424
Merged
jsugarman
merged 2 commits into
main
from
ap-3563/standardise-currency-handling-across-app
Nov 14, 2024
Merged
AP-3563/AP-5496: Standardise currency handling across the app #7424
jsugarman
merged 2 commits into
main
from
ap-3563/standardise-currency-handling-across-app
Nov 14, 2024
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
jsugarman
changed the title
AP-3565/AP-5496: Standardise currency handling across the app
AP-3563/AP-5496: Standardise currency handling across the app
Nov 12, 2024
jsugarman
force-pushed
the
ap-3563/standardise-currency-handling-across-app
branch
4 times, most recently
from
November 13, 2024 08:22
93eb131
to
89aeb61
Compare
jsugarman
commented
Nov 13, 2024
colinbruce
approved these changes
Nov 13, 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.
Looks okay to me, but maybe it would be better to get input from design to ensure consistent errors and handling?
jsugarman
force-pushed
the
ap-3563/standardise-currency-handling-across-app
branch
from
November 13, 2024 12:27
89aeb61
to
d33f55f
Compare
jsugarman
force-pushed
the
ap-3563/standardise-currency-handling-across-app
branch
4 times, most recently
from
November 13, 2024 17:23
d6ac7e3
to
0862967
Compare
This fixes an underlying bug that causes the behaviour described in the bug ticket AP-3563. Namely, that while the amount for any cash income or outgoing type is validated it is not done in the way common to other pages or forms. This has resulted in a difference whereby comma separated monetayr values, `1,000`, are invalid but where being rendered as a value when the form errors and rerenders. This has been corrected to emulate the functionality seen in form objects with monetary amount fields. 1. It now "cleans" the monetary amount params to remove `£` and `,`. 2. When rendering the form the field value is no longer rendered as a "number to currency" value with no unit - which was rendering commas for numeric values over 3 digits long.
Certain currency/amount fields accepted humanized monetary values while others did not. Some would accept but clean `£` and `,` values such that `£1,000` would become `1000` while others would error. Yet others would ignore `£` and `,` values for validation purposes but when peristing this data would not, resulting in, for example, `£2,000` become a stored value of `2.0`. This PR standardise the approach, removing `£` and `,` values prior to saving across regular incomes, regular outgoings, cash incomes, cash outgoings, state benefits, housing benefit, student finance and mandatory and discretionary capital disregards monetary amount fields. In shouldbe noted that some forms validate currency, which cleans/ignores `£` and `,` chars, while others do not validate this way. This has not been changed.
jsugarman
force-pushed
the
ap-3563/standardise-currency-handling-across-app
branch
from
November 14, 2024 11:36
0862967
to
22989fd
Compare
Quality Gate passedIssues Measures |
jsugarman
deleted the
ap-3563/standardise-currency-handling-across-app
branch
November 14, 2024 14:13
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.
What
Standardise currency handling across the app and fix existing bugs
Cash income/outgoings handling
Currency field storing invalid values
Standardise currency field handling
Certain currency/amount fields accept humanized monetary
values while others did not. Some would accept but clean
£
and,
values such that£1,000
would become1000
while others would error. Yet others would ignore
£
and,
valuesfor validation purposes but when persisting this data they would not, resulting
in, for example,
£2,000
becoming a stored value of2.0
.This PR standardise the approach, removing
£
and,
values prior to savingacross regular incomes, regular outgoings, cash incomes, cash outgoings,
state benefits, housing benefit, student finance and mandatory and discretionary
capital disregards monetary amount fields.
In should be noted that some forms validate currency, which ignores
£
and,
chars, while others do not validate this way. This has not beenchanged.
Checklist
Before you ask people to review this PR:
bundle exec rake
git rebase main
.