Skip to content

IFDM-139: new version of the present value calculator#90

Merged
jenbreese merged 5 commits into1.xfrom
IFDM-139--present-val-v2
Apr 20, 2026
Merged

IFDM-139: new version of the present value calculator#90
jenbreese merged 5 commits into1.xfrom
IFDM-139--present-val-v2

Conversation

@jenbreese
Copy link
Copy Markdown
Collaborator

@jenbreese jenbreese commented Apr 8, 2026

READY FOR REVIEW

Summary

  • This is a refactor of the current Present Value Calculator.
  • Once this is reviewed and approved by the client, we'll replace the other one with this one.
  • Can you check the math makes sense.
    - Ticket

Review By (Date)

  • Soon

Criticality

  • Normal

Review Tasks

Setup tasks and/or behavior to test

  1. Check out this branch
  2. Navigate to this calculator and check it out.
  3. Verify the math.

Front End Validation

  • Is the markup using the appropriate semantic tags and passes HTML validation?
  • Cross-browser testing has been performed?
  • Automated accessibility scans performed?
  • Manual accessibility tests performed?
  • Design is approved by @ user?

Backend / Functional Validation

Code

  • Are the naming conventions following our standards?
  • Does the code have sufficient inline comments?
  • Is there anything in this code that would be hidden or hard to discover through the UI?
  • Are there any code smells?
  • Are tests provided? eg (unit, behat, or codeception)

Code security

General

  • Is there anything included in this PR that is not related to the problem it is trying to solve?
  • Is the approach to the problem appropriate?

Affected Projects or Products

  • Does this PR impact any particular projects, products, or modules?

Associated Issues and/or People

  • JIRA ticket(s)
  • Other PRs
  • Any other contextual information that might be helpful (e.g., description of a bug that this PR fixes, new functionality that it adds, etc.)
  • Anyone who should be notified? (@mention them here)

Resources

@jenbreese jenbreese requested a review from imonroe April 17, 2026 03:58
@jenbreese jenbreese assigned jenbreese and imonroe and unassigned jenbreese Apr 17, 2026
Copy link
Copy Markdown
Collaborator

@imonroe imonroe left a comment

Choose a reason for hiding this comment

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

I think there's a small mistake with the discountAmount calculation, but please double-check me.

const totalPeriods = n * timePeriod
const periodRate = rate / n
const presentValue = futureValue / Math.pow(1 + periodRate, totalPeriods)
const discountAmount = presentValue - futureValue
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this is flipped. I think it should be
discountAmount = futureValue - presentValue? Otherwise, won't it always be negative

}

const totalPayments = paymentAmount * numberOfPayments
const discountAmount = presentValue - totalPayments
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same thing. I think it should be
discountAmount = totalPayments - presentValue?

}

return (
<div className=" p-6 max-w-5xl mx-auto">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<div className=" p-6 max-w-5xl mx-auto">
<div className="p-6 max-w-5xl mx-auto">

@jenbreese
Copy link
Copy Markdown
Collaborator Author

@imonroe I asked Claude and it agreed that the variables were flipped. I made the change. Since this calculator is a replacement for the current Present Value but at a new URL we can merge and deploy. That will allow the client to review the math without impacting the current calculator. thanks for the reviews.

@jenbreese jenbreese merged commit 94a1618 into 1.x Apr 20, 2026
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.

2 participants