-
Notifications
You must be signed in to change notification settings - Fork 13
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
Nj 75 medical #4869
Nj 75 medical #4869
Conversation
Heroku app: https://gyr-review-app-4869-f790878c64d2.herokuapp.com/ |
4a5401a
to
f6e0b1e
Compare
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 good! Left a couple comments, and looks like a couple failing tests and line_data
needs to be updated.
app/views/state_file/questions/nj_medical_expenses/edit.html.erb
Outdated
Show resolved
Hide resolved
app/views/state_file/questions/nj_medical_expenses/edit.html.erb
Outdated
Show resolved
Hide resolved
:medical_expenses | ||
|
||
validates_numericality_of :medical_expenses, only_integer: true, message: :round_to_whole_number, if: -> { medical_expenses.present? } | ||
validates :medical_expenses, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 0 }, if: -> { medical_expenses.present? } |
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.
[dust] I'm a little confused by the validating presence-true if present. It seems like nil is a valid value here, ie, they could move forward with an empty field. Is that correct?
If so, might be nice to have an explicit test to document that nil is a valid value
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.
The way I understand it - if medical_expenses.present?
THEN presence: true, allow_blank: false, greater_than_or_equal_to: 0
. Melanie can you confirm?
I tested something similar here: https://github.com/codeforamerica/vita-min/pull/4856/files#diff-62e5f3eca04b36aa7e3dd487d951844767312fbae9e56015100adc09a80f5a57, and Kevin from CFA recommended shoulda-matchers as a good way to test these.
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.
Currently this defaults to 0. This could be a good idea because of the requirement to show medical expenses on the review screen regardless of value and let the user go back and edit.
However, we can change it to allow blank, default to nil, and just show a 0 on the review screen if there is no value.
Maybe we should make some blanket decisions about defaults vs nil and add them to our internal eng practices doc?
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.
[dust] I am also confused why you have validates :medical_expenses, presence: true ... if: -> { medical_expenses.present? }
- is this just "validate true if true"?
I think we have also been wondering about when to allow blank vs requiring a 0 and it's more challenging than I expected to make a blanket decision so we often handle it on a case by case basis :/
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.
A few code style things that should be fixed before merging.
:medical_expenses | ||
|
||
validates_numericality_of :medical_expenses, only_integer: true, message: :round_to_whole_number, if: -> { medical_expenses.present? } | ||
validates :medical_expenses, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 0 }, if: -> { medical_expenses.present? } |
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.
The way I understand it - if medical_expenses.present?
THEN presence: true, allow_blank: false, greater_than_or_equal_to: 0
. Melanie can you confirm?
I tested something similar here: https://github.com/codeforamerica/vita-min/pull/4856/files#diff-62e5f3eca04b36aa7e3dd487d951844767312fbae9e56015100adc09a80f5a57, and Kevin from CFA recommended shoulda-matchers as a good way to test these.
app/views/state_file/questions/nj_medical_expenses/edit.html.erb
Outdated
Show resolved
Hide resolved
73d536e
to
3cae308
Compare
b003088
to
6a5d5b0
Compare
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.
Just the tiniest comment, otherwise looks great!
:medical_expenses | ||
|
||
validates_numericality_of :medical_expenses, only_integer: true, message: :round_to_whole_number, if: -> { medical_expenses.present? } | ||
validates :medical_expenses, presence: true, allow_blank: false, numericality: { greater_than_or_equal_to: 0 }, if: -> { medical_expenses.present? } |
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.
[dust] I am also confused why you have validates :medical_expenses, presence: true ... if: -> { medical_expenses.present? }
- is this just "validate true if true"?
I think we have also been wondering about when to allow blank vs requiring a 0 and it's more challenging than I expected to make a blanket decision so we often handle it on a case by case basis :/
211bf0e
to
9eec5aa
Compare
Link to pivotal/JIRA issue
https://github.com/newjersey/affordability-pm/issues/75
Is PM acceptance required? (delete one)
What was done?
There are a few issues that need to be resolved in this PR or a subsequent one:
The help text and label overlapping (we could do a quick fix with css obviously, but I would rather figure out why this is happening and fix that)Saw that this is also corrected in honeycrisp compact, so I corrected it for the whole applicationThe placeholder text returning to 0.00 even though I gave an empty placeholder to the currency fieldshould be fixedHow to test?
Select any directfile import and proceed to the medical expenses screen. Enter a value that is greater than 2% of gross income. When you get to the review screen, you should see medical expenses and be able to edit them.
A note for screen reader testing: one change I made here is on the review screen, where I included sr-only text to distinguish the medical expenses edit link from the others. We can use this pattern going forward and change it when we do the sundry a11y bugs ticket. The review screen should also use headers instead of styled text to indicate sections.
Screenshots (for visual changes)
https://github.com/user-attachments/assets/51d9a3d5-b81d-43c4-99e9-543ff8b06566
![Screenshot 2024-10-17 at 11 35 56 AM](https://private-user-images.githubusercontent.com/12260067/377535849-01eebbd4-a61c-4fc8-986b-2ede80daccee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1Mjk5NzEsIm5iZiI6MTczOTUyOTY3MSwicGF0aCI6Ii8xMjI2MDA2Ny8zNzc1MzU4NDktMDFlZWJiZDQtYTYxYy00ZmM4LTk4NmItMmVkZTgwZGFjY2VlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDEwNDExMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMwMjVhZjYwODMxYWE0NWYxZGY1ZGRlZTA4NTExNmI1Y2VlZjU3MDE2OTVjMDRiOThjODRmZGJmOTkzNzA3MjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.DfIPlp9FSZSnyFdNpQZNWf2YwdPQD8KRlpumpfm20U8)