You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2021/01/21 20:44:12 UTC

[GitHub] [fineract] vorburger commented on a change in pull request #1587: Add days in year at loan level #FINERACT-1302

vorburger commented on a change in pull request #1587:
URL: https://github.com/apache/fineract/pull/1587#discussion_r562184018



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
##########
@@ -336,7 +336,14 @@ private LoanApplicationTerms assembleLoanApplicationTermsFrom(final JsonElement
          */
         final DaysInMonthType daysInMonthType = loanProduct.fetchDaysInMonthType();
 
-        final DaysInYearType daysInYearType = loanProduct.fetchDaysInYearType();
+        DaysInYearType daysInYearType = null;

Review comment:
       Nit pick: remove the = null, it's not needed (because it gets assigned in either case), nicer to read, AND safer (if the code below EVER changes, it would cause a compilation failure instead of potential NPE). Makes sense?

##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResourceSwagger.java
##########
@@ -515,6 +515,8 @@ private PostLoansRequest() {}
         public String expectedDisbursementDate;
         @Schema(example = "2")
         public Integer transactionProcessingStrategyId;
+        @Schema(example = "360", allowableValues = "1, 360, 364, 36")

Review comment:
       As below, curious values? Perhaps for a good reason which I don't understand.

##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
##########
@@ -485,7 +485,14 @@ public void validateForCreate(final String json, final boolean isMeetingMandator
             baseDataValidator.reset().parameter(LoanApiConstants.datatables).value(datatables).notNull().jsonArrayNotEmpty();
         }
 
-        validateLoanMultiDisbursementdate(element, baseDataValidator, expectedDisbursementDate, principal);
+        if (this.fromApiJsonHelper.parameterExists(LoanApiConstants.daysInYearTypeParameterName, element)) {
+            final Integer daysInYearType = this.fromApiJsonHelper.extractIntegerNamed(LoanApiConstants.daysInYearTypeParameterName, element,
+                    Locale.getDefault());
+            baseDataValidator.reset().parameter(LoanApiConstants.daysInYearTypeParameterName).value(daysInYearType).notNull()
+                    .isOneOfTheseValues(1, 360, 364, 365);

Review comment:
       O don't know the details of this code, so this a general review which someone else with more in-depth knowledge may want to comment on, but years normally have 365 or 366 (leap year) days.. what's 364 used for, and 360 - and 1?!




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org