fineract-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100126 <...@git.apache.org>
Subject [GitHub] incubator-fineract pull request #256: FINERACT-7: Sort loanInstallmentCharge...
Date Wed, 14 Dec 2016 09:57:08 GMT
Github user nazeer1100126 commented on a diff in the pull request:

    https://github.com/apache/incubator-fineract/pull/256#discussion_r92356785
  
    --- Diff: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCharge.java
---
    @@ -494,17 +494,29 @@ private void updateInstallmentCharges() {
                 this.loanInstallmentCharge.addAll(chargePerInstallments);
             } else {
                 int index = 0;
    -            final LoanInstallmentCharge[] loanChargePerInstallments = new LoanInstallmentCharge[chargePerInstallments.size()];
    -            final LoanInstallmentCharge[] loanChargePerInstallmentArray = chargePerInstallments.toArray(loanChargePerInstallments);
    -            for (final LoanInstallmentCharge chargePerInstallment : this.loanInstallmentCharge)
{
    +            //FINERACT-7: NB: this is really overkill and slow, without changing the
Sets and or Entities this is the most
    +            //locally safe way to fix this issue
    +            ArrayList<LoanInstallmentCharge> oldChargeInstallments = new ArrayList<LoanInstallmentCharge>();
    +            ArrayList<LoanInstallmentCharge> newChargeInstallments = new ArrayList<LoanInstallmentCharge>();
    +
    +            oldChargeInstallments.addAll(this.loanInstallmentCharge);
    +            newChargeInstallments.addAll(chargePerInstallments);
    +            Collections.sort(oldChargeInstallments);
    +            Collections.sort(newChargeInstallments);
    +            final LoanInstallmentCharge[] loanChargePerInstallmentArray = chargePerInstallments.toArray(new
LoanInstallmentCharge[chargePerInstallments.size()]);
    --- End diff --
    
    I believe this array object is unnecessary. You can modify Loan.generateInstallmentLoanCharges(final
LoanCharge loanCharge) method to return List object. Please use this list object


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message