Aman-Mittal commented on code in PR #5428:
URL: https://github.com/apache/fineract/pull/5428#discussion_r2749613343


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanChargeService.java:
##########
@@ -853,8 +853,14 @@ private void update(final LoanCharge loanCharge, final 
BigDecimal amount, final
     private Money getTotalAllTrancheDisbursementAmount(final Loan loan) {

Review Comment:
   The method can be refactored to improve readability and maintainability. 
Consider:
   
   Flattening the nested conditionals and using early returns to clarify the 
control flow.
   
   Assigning loan.getDisbursementDetails() to a local variable to avoid 
repeated calls.
   
   Replacing the manual loop for summing disbursements with a stream-based 
reduce operation.
   
   Structuring the “sum disbursements” and “fallback principal” paths 
separately to make the logic clearer.
   
   Optionally, renaming the method to better reflect its behavior.
   
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to