galovics commented on code in PR #2668:
URL: https://github.com/apache/fineract/pull/2668#discussion_r1007996827


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionRepository.java:
##########
@@ -18,11 +18,31 @@
  */
 package org.apache.fineract.portfolio.loanaccount.domain;
 
+import java.time.LocalDate;
+import java.util.Collection;
 import java.util.Optional;
+import 
org.apache.fineract.portfolio.loanaccount.data.LoanScheduleDelinquencyData;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
 
 public interface LoanTransactionRepository extends 
JpaRepository<LoanTransaction, Long>, JpaSpecificationExecutor<LoanTransaction> 
{
 
     Optional<LoanTransaction> findByIdAndLoanId(Long transactionId, Long 
loanId);
+
+    @Query("""
+            SELECT new 
org.apache.fineract.portfolio.loanaccount.data.LoanScheduleDelinquencyData(
+                lt.loan.id,
+                lt.loan.loanProduct.id,
+                min(lt.dateOf),
+                0L,
+                lt.loan
+            ) FROM LoanTransaction lt
+            WHERE lt.typeOf = :transactionType and
+            lt.dateOf <= :businessDate and
+            lt.loan.loanProduct.delinquencyBucket is not null
+            GROUP BY lt.loan
+            """)
+    Collection<LoanScheduleDelinquencyData> 
fetchLoanWithChargebackTransactions(Integer transactionType, LocalDate 
businessDate);

Review Comment:
   Minor thing but the naming is misleading since its saying its fetching 
chargeback transactions but you pass the transactiontype as a parameter too. I 
don't mind not fixing it in this PR but please do it in an upcoming one.



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