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 125 income editing #5288

Open
wants to merge 71 commits into
base: main
Choose a base branch
from
Open

Nj 125 income editing #5288

wants to merge 71 commits into from

Conversation

mluedke2
Copy link
Contributor

@mluedke2 mluedke2 commented Dec 24, 2024

Link to pivotal/JIRA issue

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

Is PM acceptance required? (delete one)

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

Reminder: merge main into this branch and get green tests before merging to main

What was done?

  • Adapted to the new XML schema for UI/WF/SWF to UIWFSWF and UIHCWD
  • An overwrite method is now in the W2 model to capture intended behavior that combines UIHCWD into UIWFSWF if UIWFSWF is empty... and downstream calculators and XML for NJ1040 and NJ2450 also needed adapting for this.
  • The W2 model also has validation checks for the limits for those specific types of income. The validation has to be conditional to allow for importing any info, but then turned on by the Income Review and W2 Editing controllers to not allow users to proceed without fixing.
  • I decided to reuse the existing income and W2 editing controllers and forms, and put in checks for the existence of info about a given state not taxing a type of income.
  • There weren't E2E tests yet specifically for just income review so I added NJ-specific tests there for this ticket's AC

How to test?

  • Use Lucky to see W2 Box 14 editing, and O'Neal Walker for seeing messaging for other income forms.

Screenshots (for visual changes)

image

image

after trying to save values above the limits
image

image

image

@mluedke2 mluedke2 marked this pull request as ready for review December 31, 2024 20:28
@mluedke2
Copy link
Contributor Author

@jachan @mmazanec22 this is ready for review again!

@mluedke2
Copy link
Contributor Author

mluedke2 commented Jan 2, 2025

[boulder] - i need to change how i am validating the limit on W2 Box 14 because as a validation on the model I am blocking even the import of invalid values, which causes a 500 on the Lucky profile since it has a too-high value... Will likely move the validation to just be on the w2 editing form step

EDIT: Addressed now!

@mluedke2
Copy link
Contributor Author

mluedke2 commented Jan 2, 2025

[boulder] - there's also a boulder on the XML export which is still exporting both UI values for box14 instead of consolidating them.

EDIT: Addressed now!

@mluedke2
Copy link
Contributor Author

mluedke2 commented Jan 3, 2025

the two boulders have been addressed!

Copy link
Contributor

@anisharamnani anisharamnani 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, also tested MD box 14 to see if anything changed - tahsina

@@ -9,6 +9,7 @@ def edit

def update
@w2.assign_attributes(form_params)
@w2.check_box14_limits = true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note from review: can we turn on this flag in one place when the import is done?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mmazanec22 I did manage to try out an after_create callback on the W2 model to toggle check_box14_limits just after creation, which does allow import... but it's a bit of a challenge to get it to stay set, I think because the controllers re-fetch them from the database when the forms load. So I think I'd either need to

1- find a way to pass the w2 model instances from one place to another instead of loading from DB
2- add a db column for this and set it
3- keep how i have it, setting in each controller each time

I think the second option is good but is not so much better that I want to add it to this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

That seems reasonable!

end

def line_59_spouse
if @intake.filing_status_mfj?
get_personal_excess(@intake.spouse.ssn, :box14_ui_wf_swf, EXCESS_UI_WF_SWF_MAX) +
get_personal_excess(@intake.spouse.ssn, :box14_ui_hc_wd, EXCESS_UI_WF_SWF_MAX)
get_personal_excess(@intake.spouse.ssn, :box14_ui_wf_swf, EXCESS_UI_WF_SWF_MAX)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

review comment: instead of passing excess type, could just pass the value itself

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mmazanec22 actually, i looked at this again and because get_excess_value() is called within two different iterators (ie needs to look at several w2s), it actually makes that function not so easy to get rid of...

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we add this to the follow up ticket as a "take a look at this"? I don't fully understand why we can't pass in get_box14_ui_overwrite instead of the field name here

if value.present? && value > limit
errors.add(field, I18n.t("validators.dollar_limit", limit: '%.2f' % limit))
end
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

review comment: check if it would be cleaner to put this in the NJ-specific W2

Copy link
Contributor Author

@mluedke2 mluedke2 Jan 7, 2025

Choose a reason for hiding this comment

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

@mmazanec22 it looks like we don't actually have an NJ-specific W2 model yet. we could add one, but i think i will make a follow-up ticket for this

https://github.com/orgs/newjersey/projects/74/views/1?pane=issue&itemId=92886410&issue=newjersey%7Caffordability-pm%7C241

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, meant this comment for the XML builder file. Follow up seems fine to me though

@w2.get_box14_ui_overwrite
else
@w2.send(field_name)
end %>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

review comment: could a method on the W2 model prevent us from having to do all these if-else to get these values?

Copy link
Contributor Author

@mluedke2 mluedke2 Jan 8, 2025

Choose a reason for hiding this comment

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

@mmazanec22 I want to keep this one open too, but since it's only used in a few spots (and in different ways) I think I want to leave as a follow-up in the same ticket as above https://github.com/orgs/newjersey/projects/74/views/1?pane=issue&itemId=92886410&issue=newjersey%7Caffordability-pm%7C241

sum + (w2.box14_ui_hc_wd || 0) + (w2.box14_ui_wf_swf || 0)
end
total.round
w2s.sum { |w2| w2.get_box14_ui_overwrite || 0 }.round
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, more readable

@@ -9,6 +9,7 @@ def edit

def update
@w2.assign_attributes(form_params)
@w2.check_box14_limits = true
Copy link
Contributor

Choose a reason for hiding this comment

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

That seems reasonable!

if value.present? && value > limit
errors.add(field, I18n.t("validators.dollar_limit", limit: '%.2f' % limit))
end
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, meant this comment for the XML builder file. Follow up seems fine to me though

end

def line_59_spouse
if @intake.filing_status_mfj?
get_personal_excess(@intake.spouse.ssn, :box14_ui_wf_swf, EXCESS_UI_WF_SWF_MAX) +
get_personal_excess(@intake.spouse.ssn, :box14_ui_hc_wd, EXCESS_UI_WF_SWF_MAX)
get_personal_excess(@intake.spouse.ssn, :box14_ui_wf_swf, EXCESS_UI_WF_SWF_MAX)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we add this to the follow up ticket as a "take a look at this"? I don't fully understand why we can't pass in get_box14_ui_overwrite instead of the field name here

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.

5 participants