angelboxes commented on a change in pull request #614: Stop creating 
unnecessary overdue charge when amount is 0.
URL: https://github.com/apache/fineract/pull/614#discussion_r306397705
 
 

 ##########
 File path: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
 ##########
 @@ -2490,6 +2493,9 @@ public LoanOverdueDTO 
applyChargeToOverdueLoanInstallment(final Long loanId, fin
 
                 final LoanCharge loanCharge = 
LoanCharge.createNewFromJson(loan, chargeDefinition, command, entry.getValue());
 
+                if (BigDecimal.ZERO.compareTo(loanCharge.amount()) == 0) {
+                    return null;
 
 Review comment:
   I don't think its okay to return null in this line, as you can see in this 
part of the code there is a for statement that iterates through a set of dates. 
If the amount for charge in the first date entry were to be 0, the next dates 
wouldn't create any new charges even if the charge amount is suposed to be 
greater than 0.
   
   I suggest to replace the return null statement with a continue statement, to 
continue iterating the entry set

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to