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 235 - fix calculator negative value bug #5706

Merged
merged 2 commits into from
Mar 10, 2025

Conversation

jachan
Copy link
Contributor

@jachan jachan commented Mar 7, 2025

Link to pivotal/JIRA issue

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?

  • Problem reported was that review screen contained a negative value for "NJ taxable income" (see screenshot)
  • Looked in the calculator and we were allowing negative values for many of the subtractions.
  • Added checks for all subtraction calculations in the NJ calculator. If line value was negative, set it to zero instead

How to test?

  • Use Eastern Goldfinch persona continue to end of the flow and look at NJ taxable income on the review screen

Screenshots (for visual changes)

  • Before
    image

  • After
    image

Copy link

github-actions bot commented Mar 7, 2025

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

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.

One small test improvement, otherwise looks good! Appreciate you finding all the relevant cases here & futureproofing

Comment on lines 735 to 741
context 'when 28c is larger than 29' do
it 'sets line 29 to zero' do
allow(instance).to receive(:calculate_line_15).and_return 1_000
allow(instance).to receive(:calculate_line_16a).and_return 1_000
allow(instance).to receive(:calculate_line_28c).and_return 2_001
instance.calculate
expect(instance.lines[:NJ1040_LINE_29].value).to eq(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

[pebble] I think the test title is misleading here? It should be "when 28c is greater than line 27" (from looking at the code) right?

Additionally, if that is the case, I'd suggest/prefer to see the test simplified by just mocking Line 27 and Line 28c rather than lines 15 and 16a, which seems more complicated and harder to read/parse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. The logic for line 27 has also changed in the meantime so this makes it more accurate.

Copy link
Contributor

@jnf jnf left a comment

Choose a reason for hiding this comment

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

lgtm!

@jachan jachan merged commit 66df892 into main Mar 10, 2025
7 checks passed
@jachan jachan deleted the nj-235-bug-negative-amount-on-review-screen branch March 10, 2025 13:21
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