oleksii-novikov-onix commented on code in PR #6070:
URL: https://github.com/apache/fineract/pull/6070#discussion_r3527306563


##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanBreachScheduleServiceImpl.java:
##########
@@ -290,6 +294,19 @@ public void recalculatePeriodsForPauses(final 
WorkingCapitalLoan loan) {
                 effectivePauses.size());
     }
 
+    @Override
+    public void reEvaluateAfterEnable(final WorkingCapitalLoan loan, final 
LocalDate enableDate) {
+        final Optional<WorkingCapitalBreach> breachOpt = getBreachConfig(loan);
+        if (breachOpt.isEmpty()) {
+            return;
+        }
+        generateNextPeriodIfNeeded(loan, enableDate);
+        final List<WorkingCapitalLoanBreachSchedule> periods = 
repository.findByLoanIdOrderByPeriodNumberAsc(loan.getId());
+        periods.stream().filter(period -> period.getBreach() == 
null).forEach(period -> recomputeBreach(period, enableDate));

Review Comment:
   Agreed, I will drop the null filter and make ENABLE a full rebuild: 
recalculate paid/outstanding from actual transactions and recompute breach 
flags for all periods up to the enable date.



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