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 224 check claimed as dependent for lines 10 and 11 #5312

Merged
merged 10 commits into from
Jan 6, 2025
Merged

Conversation

mluedke2
Copy link
Contributor

@mluedke2 mluedke2 commented Jan 4, 2025

Link to pivotal/JIRA issue

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

Is PM acceptance required?

  • 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?

  • Added requirement that dependent must be explicitly claimed as dependent in JSON to count for lines 10 or 11
  • The rest is just adjusting test cases. The XML and PDF tests for this were coupled with the calculator so I instead set them to have a mocked calculator.

How to test?

  • Latifah is the only profile that will show new changes: will have 0 for lines 10 or 11 (before would have had 1 on line 10)
  • Others remain the same:
    • Minimal will have 0 for lines 10 or 11
    • Sinatra will have 1 on line 10
    • Zeus many deps will have 10 on line 10 and 1 on line 11

Screenshots

Latifah:

image

Copy link

github-actions bot commented Jan 4, 2025

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

@mluedke2 mluedke2 marked this pull request as ready for review January 4, 2025 00:12
@mluedke2 mluedke2 changed the title Nj 224 qual dep Nj 224 check claimed as dependent for lines 10 and 11 Jan 4, 2025
Comment on lines 226 to 227
@intake.direct_file_json_data.dependents.count do |dependent|
dependent.qualifying_child
dependent.qualifying_child && dependent.is_claimed_dependent
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'm ok with how this is, but so you know, the qualifying_child column in StateFileDependent is populated from direct_file_json_data during import, and all of the dependents in intake.dependents have already been filtered to be only claimed dependents.

It would be a better practice to avoid extracting data from the json when it is available in the database, especially, for example, if you needed to access other dependent fields from the database that aren't in the json.

Copy link
Contributor Author

@mluedke2 mluedke2 Jan 6, 2025

Choose a reason for hiding this comment

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

@mpidcock I didn't know that! When I search the codebase for either is_claimed_dependent or isClaimedDependent, I didn't come across any references that pointed me towards logic like that? Can you help me find it?

But regardless, I tried simplifying the logic as you said and sure enough the tests still pass. So I'll push a change to

def calculate_line_10_count
  @intake.dependents.count do |dependent|
    dependent.qualifying_child
  end
end

...

def calculate_line_11_count
  @intake.dependents.count do |dependent|
    !dependent.qualifying_child
  end
end

Copy link
Member

@mpidcock mpidcock Jan 6, 2025

Choose a reason for hiding this comment

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

@mluedke2 Well, we don't actually have a method to filter claimed dependents, because the list of dependents sourced from the XML is specifically a list of only claimed dependents. It was new this year to have json data for other members of the household, but since our database gets instantiated with the xml data and augmented by the json data, the non-dependent household members are simply never added to the list of dependents. I hope that helps and let me know if I can clarify anything else!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh ok that makes sense. Thanks!

it "does not fill in" do
allow_any_instance_of(Efile::Nj::Nj1040Calculator).to receive(:calculate_line_10_count).and_return 0
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an improvement!

@@ -383,25 +375,10 @@
end

describe "total exemption - lines 13 and 30" do
let(:intake) { create(:state_file_nj_intake, :primary_over_65, :primary_blind, :primary_veteran, :two_dependents_in_college) }
it "totals lines 6-12 and stores the result in both TotalExemptionAmountA and TotalExemptionAmountB" do
line_6_single_filer = 1_000
Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense to remove this, as it is covered in the calculator tests

@mluedke2 mluedke2 merged commit ae5bf6c into main Jan 6, 2025
7 checks passed
@mluedke2 mluedke2 deleted the nj-224-qual-dep branch January 6, 2025 17:36
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.

3 participants