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


##########
fineract-provider/src/main/java/org/apache/fineract/cob/service/InlineLoanCOBExecutorServiceImpl.java:
##########
@@ -96,6 +99,26 @@ public CommandProcessingResult executeInlineJob(JsonCommand 
command, String jobN
 
     @Override
     public void execute(List<Long> loanIds, String jobName) {
+        LocalDate cobBusinessDate = 
ThreadLocalContextUtil.getBusinessDateByType(BusinessDateType.COB_DATE);
+        List<Loan> loansToBeProcessed = getLoansToBeProcessed(loanIds, 
cobBusinessDate);
+        LocalDate executingBusinessDate = 
getOldestCOBBusinessDate(loansToBeProcessed).plusDays(1);
+        if (!loansToBeProcessed.isEmpty()) {
+            while (executingBusinessDate.isBefore(cobBusinessDate)) {
+                execute(getLoanIdsToBeProcessed(loansToBeProcessed, 
executingBusinessDate), jobName, executingBusinessDate);
+                executingBusinessDate = executingBusinessDate.plusDays(1);
+            }
+            List<Long> loanIdsToBeProcessed = 
loansToBeProcessed.stream().map(Loan::getId).toList();

Review Comment:
   Why do we execute it one more time?



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