fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From my...@apache.org
Subject [fineract-cn-reporting] 07/24: only add where if criteria available added trialing 00 if no decimals available
Date Mon, 22 Jan 2018 15:31:04 GMT
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-reporting.git

commit fe4f978fe82830e0d3dd19539a5c75a188647520
Author: mgeiss <mgeiss@mifos.org>
AuthorDate: Sat Jul 8 05:24:59 2017 +0200

    only add where if criteria available
    added trialing 00 if no decimals available
---
 .../internal/specification/CustomerListReportSpecification.java  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/service/src/main/java/io/mifos/reporting/service/internal/specification/CustomerListReportSpecification.java
b/service/src/main/java/io/mifos/reporting/service/internal/specification/CustomerListReportSpecification.java
index c799f68..90bfbd9 100644
--- a/service/src/main/java/io/mifos/reporting/service/internal/specification/CustomerListReportSpecification.java
+++ b/service/src/main/java/io/mifos/reporting/service/internal/specification/CustomerListReportSpecification.java
@@ -193,7 +193,7 @@ public class CustomerListReportSpecification implements ReportSpecification
{
         row.getValues().add(value);
       }
 
-      final DecimalFormat decimalFormat = new DecimalFormat("0.##");
+      final DecimalFormat decimalFormat = new DecimalFormat("0.00");
       final Query accountQuery = this.entityManager.createNativeQuery(this.buildAccountQuery(reportRequest,
customerIdentifier));
       final List<?> accountResultList = accountQuery.getResultList();
       final ArrayList<String> values = new ArrayList<>();
@@ -260,7 +260,6 @@ public class CustomerListReportSpecification implements ReportSpecification
{
 
     final List<QueryParameter> queryParameters = reportRequest.getQueryParameters();
     if (!queryParameters.isEmpty()) {
-      query.append(" WHERE ");
       final ArrayList<String> criteria = new ArrayList<>();
       queryParameters.forEach(queryParameter -> {
         if(queryParameter.getValue() != null && !queryParameter.getValue().isEmpty())
{
@@ -270,7 +269,11 @@ public class CustomerListReportSpecification implements ReportSpecification
{
         }
       });
 
-      query.append(criteria.stream().collect(Collectors.joining(" AND ")));
+      if (!criteria.isEmpty()) {
+        query.append(" WHERE ");
+        query.append(criteria.stream().collect(Collectors.joining(" AND ")));
+      }
+
     }
     query.append(" ORDER BY cst.identifier");
 

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

Mime
View raw message