:hammer: Use only one 'interest amount' variable to return · FagnerMartinsBrack/jack-the-moneylender@649a980
View original- current
This article is too short to summarise.
@@ -18,34 +18,24 @@
1818const greaterThan5000 = { endOfRange: Money('$5000.00'), interestPerDollar: Money('$0.14'), previousInterestPerDollar: Money('$0.09') };
1919const greaterThan10000 = { endOfRange: Money('$10000.00'), interestPerDollar: Money('$0.21'), previousInterestPerDollar: Money('$0.14') };
202021-if (loanAmount.greaterThan(Money('$2000.00')) && loanAmount.lessThan(Money('$5001.00'))) {
22-let interestAmount = Money('$0.00');
21+let interestAmount = Money('$0.00');
232223+if (loanAmount.greaterThan(Money('$2000.00')) && loanAmount.lessThan(Money('$5001.00'))) {
2424interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan2000));
25-26-return interestAmount;
2725}
28262927if (loanAmount.greaterThan(Money('$5000.00')) && loanAmount.lessThan(Money('$10001.00'))) {
30-let interestAmount = Money('$0.00');
31-3228interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan2000));
3329interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan5000));
34-35-return interestAmount;
3630}
37313832if (loanAmount.greaterThan(Money('$10000.00'))) {
39-let interestAmount = Money('$0.00');
40-4133interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan2000));
4234interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan5000));
4335interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan10000));
44-45-return interestAmount;
4636}
473748-return Money('$0.00');
38+return interestAmount;
4939};
50405141QUnit.module('Loans of $2000 and below are interest-free. For example');