← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19816: Event analytics, program indicators, rounding

 

------------------------------------------------------------
revno: 19816
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-08-21 18:55:56 -0400
message:
  Event analytics, program indicators, rounding
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java	2015-08-21 03:35:34 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java	2015-08-21 22:55:56 +0000
@@ -36,6 +36,7 @@
 import static org.hisp.dhis.commons.util.TextUtils.removeLastOr;
 import static org.hisp.dhis.commons.util.TextUtils.trimEnd;
 import static org.hisp.dhis.system.util.DateUtils.getMediumDateString;
+import static org.hisp.dhis.system.util.MathUtils.getRounded;
 
 import java.util.List;
 
@@ -58,8 +59,8 @@
 import org.hisp.dhis.legend.Legend;
 import org.hisp.dhis.option.Option;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.program.ProgramIndicator;
 import org.hisp.dhis.program.ProgramIndicatorService;
-import org.hisp.dhis.system.util.MathUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.BadSqlGrammarException;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -188,10 +189,16 @@
                 grid.addValue( dimensionValue );
             }
             
-            if ( params.hasValueDimension() || params.hasProgramIndicatorDimension() )
-            {
-                double value = rowSet.getDouble( "value" );
-                grid.addValue( params.isSkipRounding() ? value : MathUtils.getRounded( value ) );
+            if ( params.hasValueDimension() )
+            {
+                double value = rowSet.getDouble( "value" );
+                grid.addValue( params.isSkipRounding() ? value : getRounded( value ) );
+            }
+            else if ( params.hasProgramIndicatorDimension() )
+            {
+                double value = rowSet.getDouble( "value" );
+                ProgramIndicator indicator = params.getProgramIndicator();
+                grid.addValue( indicator.hasDecimals() ? getRounded( value, indicator.getDecimals() ) : getRounded( value ) );
             }
             else
             {