galovics commented on code in PR #5100:
URL: https://github.com/apache/fineract/pull/5100#discussion_r2430064673
##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/delinquency/service/LoanDelinquencyDomainServiceImpl.java:
##########
@@ -200,31 +203,27 @@ public LoanDelinquencyData getLoanDelinquencyData(final
Loan loan, List<LoanDeli
log.debug("Loan id {} with overdue since date {} and outstanding
amount {}", loan.getId(), overdueSinceDate, outstandingAmount);
long overdueDays = 0L;
+ Long pausedDays = 0L;
if (overdueSinceDate != null) {
overdueDays = DateUtils.getDifferenceInDays(overdueSinceDate,
businessDate);
if (overdueDays < 0) {
overdueDays = 0L;
}
collectionData.setPastDueDays(overdueDays);
+ pausedDays =
delinquencyEffectivePauseHelper.getPausedDaysBeforeDate(effectiveDelinquencyList,
businessDate);
overdueSinceDate =
overdueSinceDate.plusDays(graceDays.longValue());
collectionData.setDelinquentDate(overdueSinceDate);
}
collectionData.setDelinquentAmount(outstandingAmount);
collectionData.setDelinquentDays(0L);
final long delinquentDays = overdueDays - graceDays;
if (delinquentDays > 0) {
- calculateDelinquentDays(effectiveDelinquencyList, businessDate,
collectionData, delinquentDays);
+ Long calculatedDelinquentDays = delinquentDays - pausedDays;
Review Comment:
I'd love to extract this logic into a method that can be reused, otherwise I
fear this duplicated (triplicated) logic would be changed in the future only in
1 place, not at the rest of them.
The pausedDays retrieval can also be included here instead and in the
extracted method.
If that's done, I think we're good.
--
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]