adamsaghy commented on code in PR #3924:
URL: https://github.com/apache/fineract/pull/3924#discussion_r1634743321
##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java:
##########
@@ -3286,60 +3063,36 @@ private void handleLoanOverpayment(LocalDate
transactionDate, final LoanLifecycl
private boolean isChronologicallyLatestRepaymentOrWaiver(final
LoanTransaction loanTransaction,
final List<LoanTransaction> loanTransactions) {
- boolean isChronologicallyLatestRepaymentOrWaiver = true;
-
- final LocalDate currentTransactionDate =
loanTransaction.getTransactionDate();
- for (final LoanTransaction previousTransaction : loanTransactions) {
- if (!previousTransaction.isDisbursement() &&
previousTransaction.isNotReversed()
- && (DateUtils.isBefore(currentTransactionDate,
previousTransaction.getTransactionDate())
- || (DateUtils.isEqual(currentTransactionDate,
previousTransaction.getTransactionDate())
- && ((loanTransaction.getId() == null &&
previousTransaction.getId() == null)
- || (loanTransaction.getId() !=
null && (previousTransaction.getId() == null
- ||
loanTransaction.getId().compareTo(previousTransaction.getId()) < 0)))))) {
- isChronologicallyLatestRepaymentOrWaiver = false;
- break;
- }
- }
- return isChronologicallyLatestRepaymentOrWaiver;
+ return loanTransactions.stream()
+ .noneMatch(previousTransaction ->
!previousTransaction.isDisbursement() && !previousTransaction.isReversed()
Review Comment:
Please double check as i believe the negated version would be different:
from < to =>
--
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]