oleksii-novikov-onix commented on code in PR #4288:
URL: https://github.com/apache/fineract/pull/4288#discussion_r1937006891
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/data/ProgressiveLoanInterestScheduleModel.java:
##########
@@ -175,7 +176,9 @@ public Optional<RepaymentPeriod>
updateInterestPeriodsForInterestPause(final Loc
private boolean isPeriodInRange(final RepaymentPeriod repaymentPeriod,
final LocalDate fromDate, final LocalDate endDate) {
return DateUtils.isDateInRangeFromExclusiveToInclusive(fromDate,
repaymentPeriod.getFromDate(), repaymentPeriod.getDueDate())
- || DateUtils.isDateInRangeFromExclusiveToInclusive(endDate,
repaymentPeriod.getFromDate(), repaymentPeriod.getDueDate());
+ || DateUtils.isDateInRangeFromExclusiveToInclusive(endDate,
repaymentPeriod.getFromDate(), repaymentPeriod.getDueDate())
+ || (!DateUtils.isAfter(fromDate, repaymentPeriod.getFromDate())
Review Comment:
The `isPeriodInRange ` method helps us find repayment periods in which we
want to rebuild interest periods. The last condition is responsible for
identifying repayment periods that are fully within the pause because the pause
can starts much earlier and ends later.
For example, if a pause is declared from 01.02 to 01.05, without the last
condition, we will miss the period 01.03 to 01.04.
After your question, I reconsidered the logic a bit, and I would like to
rewrite this method as:
```
private boolean isPeriodInRange(final RepaymentPeriod repaymentPeriod, final
LocalDate fromDate, final LocalDate endDate) {
return !repaymentPeriod.getFromDate().isAfter(endDate)
&& !repaymentPeriod.getDueDate().isBefore(fromDate);
}
```
--
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]