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

Nj 75 medical #4869

Merged
merged 5 commits into from
Oct 23, 2024
Merged

Nj 75 medical #4869

merged 5 commits into from
Oct 23, 2024

Conversation

mmazanec22
Copy link
Contributor

@mmazanec22 mmazanec22 commented Oct 17, 2024

Link to pivotal/JIRA issue

https://github.com/newjersey/affordability-pm/issues/75

Is PM acceptance required? (delete one)

  • Yes - don't merge until JIRA issue is accepted!

What was done?

  • Add medical expenses column
  • Add calculated medical expenses deduction
  • Include medical expenses deduction in line 38

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 application
  • The placeholder text returning to 0.00 even though I gave an empty placeholder to the currency field should be fixed
  • We need to update honeycrisp so we can use the accessible reveal component here and elsewhere

How 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

Copy link

Heroku app: https://gyr-review-app-4869-f790878c64d2.herokuapp.com/
View logs: heroku logs --app gyr-review-app-4869 (optionally add --tail)

@mmazanec22 mmazanec22 marked this pull request as draft October 17, 2024 15:47
Copy link
Contributor

@aloverso aloverso left a 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_review/edit.html.erb Outdated Show resolved Hide resolved
config/locales/en.yml 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? }
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Member

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 :/

spec/lib/efile/nj/nj1040_calculator_spec.rb Outdated Show resolved Hide resolved
spec/lib/pdf_filler/nj1040_pdf_spec.rb Show resolved Hide resolved
Copy link
Contributor

@jachan jachan left a 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? }
Copy link
Contributor

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.

config/locales/es.yml Outdated Show resolved Hide resolved
app/lib/efile/nj/nj1040_calculator.rb Show resolved Hide resolved
@mmazanec22 mmazanec22 marked this pull request as ready for review October 18, 2024 15:18
@mmazanec22 mmazanec22 force-pushed the nj-75-medical branch 3 times, most recently from b003088 to 6a5d5b0 Compare October 21, 2024 13:30
Copy link
Member

@mpidcock mpidcock left a 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? }
Copy link
Member

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 :/

@mmazanec22 mmazanec22 merged commit 2c5d650 into main Oct 23, 2024
7 checks passed
@mmazanec22 mmazanec22 deleted the nj-75-medical branch October 23, 2024 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants