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

Fixed Divide by Zero Error in Loans Dialog #5072

Merged
merged 3 commits into from
Oct 21, 2024

Conversation

IllianiCBT
Copy link
Collaborator

@IllianiCBT IllianiCBT commented Oct 19, 2024

In the event there is 0% interest on a loan we now divide the loan principal by the number of payments.

Closes #5023

Adjusted the logic to enforce a minimum interest rate of 1% when setting the interest rate for new loans.
@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.54%. Comparing base (39d3485) to head (918f04b).
Report is 122 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5072      +/-   ##
============================================
+ Coverage     10.42%   10.54%   +0.11%     
- Complexity     6035     6044       +9     
============================================
  Files           953      955       +2     
  Lines        134268   134145     -123     
  Branches      19456    19473      +17     
============================================
+ Hits          14003    14150     +147     
+ Misses       118922   118650     -272     
- Partials       1343     1345       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HammerGS
Copy link
Member

Should 1% be the basement? History today has some example of sub-prime loans to large organizations, and even near 0% to individuals. I've seen one at .149% as recent as last year.

@IllianiCBT
Copy link
Collaborator Author

Pick a number and I'll implement it. It's a very easy thing to change :)

@IllianiCBT IllianiCBT changed the title Enforce a Minimum Interest Rate of 1% in Loan Calculations Fixed Divide by Zero Error in Loans Dialog Oct 21, 2024
Updated `Loan.java` to correctly calculate payment amount when interest is zero. Removed unnecessary minimum rate enforcement in `NewLoanDialog.java` to allow for zero interest rates.
@IllianiCBT
Copy link
Collaborator Author

Updated description based on Hammer's feedback.

@HammerGS HammerGS merged commit b2d982f into MegaMek:master Oct 21, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Division by 0 in Loan window
3 participants