Cocoa-Puffs commented on code in PR #5966:
URL: https://github.com/apache/fineract/pull/5966#discussion_r3387174451


##########
fineract-core/src/main/java/org/apache/fineract/commands/service/CommandSourceService.java:
##########
@@ -100,6 +100,15 @@ public CommandSource saveResultSameTransaction(@NonNull 
CommandSource commandSou
         return saveResult(commandSource);
     }
 
+    @Transactional(propagation = Propagation.REQUIRED)
+    public void saveResultSameTransaction(Long commandSourceId, Integer 
response, String body) {

Review Comment:
   The method name might be misleading here. It implies that the result is 
always saved in the same transaction, but propagation required creates a new 
transaction if the method was called with none. Should this be changed to 
propagation mandatory?



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/WorkingCapitalLoanCOBFilterHelperImpl.java:
##########
@@ -110,18 +111,25 @@ private boolean isLoanHardLocked(Long... loanIds) {
     }
 
     private boolean isLoanHardLocked(List<Long> loanIds) {
-        return 
loanIds.stream().anyMatch(loanAccountLockService::isLoanHardLocked);
+        if (loanIds.size() == 1) {

Review Comment:
   Why is it necessary here to use separate method calls if the method was 
called with a singular loan id? Is it just so we don't use the IN clause with 
single element lists? Same question for isLockOverrulable in this class.



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBFilterHelperImpl.java:
##########
@@ -124,32 +123,33 @@ public boolean isBypassUser() {
     }
 
     private List<Long> getGlimChildLoanIds(Long loanIdFromRequest) {
-        GroupLoanIndividualMonitoringAccount glimAccount = 
glimAccountInfoRepository.findOneByIsAcceptingChildAndApplicationId(true,
-                BigDecimal.valueOf(loanIdFromRequest));
-        if (glimAccount != null) {
-            return 
glimAccount.getChildLoan().stream().map(Loan::getId).toList();
-        } else {
-            return Collections.emptyList();
-        }
+        return 
glimAccountInfoRepository.findChildLoanIdsByIsAcceptingChildAndApplicationId(true,
 BigDecimal.valueOf(loanIdFromRequest));
     }
 
     private boolean isLoanHardLocked(Long... loanIds) {
         return isLoanHardLocked(Arrays.asList(loanIds));
     }
 
     private boolean isLoanHardLocked(List<Long> loanIds) {
-        return 
loanIds.stream().anyMatch(loanAccountLockService::isLoanHardLocked);
+        if (loanIds.size() == 1) {

Review Comment:
   Why is it necessary here to use separate method calls if the method was 
called with a singular loan id? Is it just so we don't use the IN clause with 
single element lists? Same question for isLockOverrulable in this class.



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