mariiaKraievska commented on code in PR #6109:
URL: https://github.com/apache/fineract/pull/6109#discussion_r3550694442
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/repository/WorkingCapitalLoanBreachActionRepository.java:
##########
@@ -41,4 +41,33 @@ select case when count(action) > 0 then true else false end
from WorkingCapitalL
""")
boolean isBreachDisabledAsOf(@Param("loanId") Long loanId, @Param("date")
LocalDate date);
+ @Query("""
+ select resetAction from WorkingCapitalLoanBreachAction resetAction
+ where resetAction.workingCapitalLoan.id = :workingCapitalLoanId
+ and resetAction.action =
org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanBreachActionType.RESET
+ and resetAction.id = (
+ select max(latestReset.id) from WorkingCapitalLoanBreachAction
latestReset
+ where latestReset.workingCapitalLoan.id = :workingCapitalLoanId
+ and latestReset.action =
org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanBreachActionType.RESET
+ )
+ and not exists (
+ select undoResetAction.id from WorkingCapitalLoanBreachAction
undoResetAction
+ where undoResetAction.workingCapitalLoan.id =
:workingCapitalLoanId
+ and undoResetAction.action =
org.apache.fineract.portfolio.workingcapitalloan.domain.WorkingCapitalLoanBreachActionType.UNDO_RESET
+ and undoResetAction.id > resetAction.id
+ )
+ """)
+ Optional<WorkingCapitalLoanBreachAction>
findLatestActiveReset(@Param("workingCapitalLoanId") Long workingCapitalLoanId);
Review Comment:
Could we revisit this query? It currently checks activity only for the
latest RESET id, so after undoing the latest reset it may return no active
reset even when an earlier RESET is still active (LIFO case,
@TestRailId:C85431).
--
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]