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

feat: calculate totalInterest in Mortgage class #119

Merged
merged 8 commits into from
Oct 17, 2024
Merged

Conversation

zz-hh-aa
Copy link
Collaborator

@zz-hh-aa zz-hh-aa commented Oct 15, 2024

What does this PR do?

  • Calculates the total paid towards interest over the term of a mortgage (add this as a property to the Mortgage class)
{176E1494-1EAE-424F-90FD-E8172F412190} - Calculates the total interest saved on Fairhold tenures, relative to the total interest paid in marketPurchase

NB: There's another instance of principal that will also need fixing once #117 is merged.

Closes #118

Copy link

vercel bot commented Oct 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fairhold-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 17, 2024 9:57am

@zz-hh-aa
Copy link
Collaborator Author

If we merge #123 into this branch first, it should resolve the test issue above!

@@ -110,4 +112,9 @@ export class Mortgage {

return yearlyPaymentBreakdown;
}
private calculateTotalInterest() {
const totalInterest = parseFloat((this.principal * this.interestRate * this.termYears).toFixed(2))
console.log("Total interest: ", totalInterest)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Leftover console.log

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, thanks!

…tests

fix: update tests following interest calculation functionality
@zz-hh-aa zz-hh-aa merged commit 1292bba into main Oct 17, 2024
5 checks passed
@zz-hh-aa zz-hh-aa deleted the oz/calculate-interest branch October 17, 2024 12:41
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.

Calculate interest saved with Fairhold
2 participants