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


##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/repository/WorkingCapitalLoanDelinquencyActionRepository.java:
##########
@@ -33,4 +36,11 @@ public interface 
WorkingCapitalLoanDelinquencyActionRepository extends JpaReposi
     Optional<WorkingCapitalLoanDelinquencyAction> 
findTopByWorkingCapitalLoanIdAndActionOrderByIdDesc(Long workingCapitalLoanId,
             DelinquencyAction action);
 
+    @Query("""
+            select case when count(action) > 0 then true else false end from 
WorkingCapitalLoanDelinquencyAction action
+            where action.action = 
org.apache.fineract.portfolio.delinquency.domain.DelinquencyAction.DISABLE
+            and action.workingCapitalLoan.id = :loanId and action.startDate <= 
:date and action.endDate is null
+            """)
+    boolean isDelinquencyDisabledAsOf(@Param("loanId") Long loanId, 
@Param("date") LocalDate date);

Review Comment:
   This query seems incomplete.
   
   Would the following be better?
   ```
   select case when count(action) > 0 then true else false end from 
WorkingCapitalLoanDelinquencyAction action
               where action.action = 
org.apache.fineract.portfolio.workingcapitalloan.domain.DelinquencyAction.DISABLE
               and action.workingCapitalLoan.id = :loanId and action.startDate 
<= :date and (action.endDate IS NULL OR action.endDate >= :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