← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3782: Fixed bug, values in default dataset report not displayed properly

 

------------------------------------------------------------
revno: 3782
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2011-05-29 22:11:57 +0200
message:
  Fixed bug, values in default dataset report not displayed properly
modified:
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.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-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java	2011-05-10 11:39:42 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java	2011-05-29 20:11:57 +0000
@@ -70,7 +70,6 @@
 import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
 import org.hisp.dhis.system.grid.ListGrid;
 import org.hisp.dhis.system.util.FilterUtils;
-import org.hisp.dhis.system.util.MathUtils;
 
 /**
  * @author Abyot Asalefew
@@ -405,21 +404,18 @@
 
             for ( DataElementCategoryOptionCombo optionCombo : orderedOptionCombos )
             {
-                String value = "";
+                Double value = null;
 
                 if ( selectedUnitOnly )
                 {
                     DataValue dataValue = dataValueService.getDataValue( unit, dataElement, period, optionCombo );
-                    value = (dataValue != null) ? dataValue.getValue() : null;
+                    value = dataValue != null && dataValue.getValue() != null ? Double.parseDouble( dataValue.getValue() ) : null;
                 }
                 else
                 {
-                    Double aggregatedValue = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ? aggregationService
-                        .getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(), period.getEndDate(), unit )
-                        : aggregatedDataValueService.getAggregatedValue( dataElement, optionCombo, period, unit );
-
-                    value = (aggregatedValue != null) ? String.valueOf( MathUtils.getRounded( aggregatedValue, 0 ) )
-                        : null;
+                    value = aggregationStrategy.equals( AGGREGATION_STRATEGY_REAL_TIME ) ? 
+                        aggregationService.getAggregatedDataValue( dataElement, optionCombo, period.getStartDate(), period.getEndDate(), unit ) : 
+                        aggregatedDataValueService.getAggregatedValue( dataElement, optionCombo, period, unit );
                 }
 
                 grid.addValue( value );