adamsaghy commented on code in PR #6205:
URL: https://github.com/apache/fineract/pull/6205#discussion_r3749087659


##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanBreachScheduleServiceImpl.java:
##########
@@ -260,6 +255,23 @@ public void rescheduleMinimumPayment(final 
WorkingCapitalLoan loan) {
                 params.minimumPayment(), params.minimumPaymentType(), 
newFrequency, newFreqType);
     }
 
+    @Override
+    public Optional<LocalDate> calculateRescheduledCurrentPeriodToDate(final 
Long loanId, final Integer frequency,
+            final WorkingCapitalLoanPeriodFrequencyType frequencyType) {
+        return findCurrentOpenPeriod(loanId, DateUtils.getBusinessLocalDate())
+                .map(currentPeriod -> resolveRescheduledToDate(loanId, 
currentPeriod, frequency, frequencyType));
+    }
+
+    private Optional<WorkingCapitalLoanBreachSchedule> 
findCurrentOpenPeriod(final Long loanId, final LocalDate businessDate) {
+        return 
repository.findCurrentOpenPeriodsOrderByPeriodNumberDesc(loanId, 
businessDate).stream().findFirst();

Review Comment:
   pass Limit.of(1) so the DB truncates.



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