← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1973: Fixed bug related to loading of GIS datalement values

 

------------------------------------------------------------
revno: 1973
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-08-26 08:44:24 +0200
message:
  Fixed bug related to loading of GIS datalement values
modified:
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.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-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2010-07-11 06:05:31 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2010-08-26 06:44:24 +0000
@@ -164,16 +164,15 @@
         {
             Double value = aggregationService.getAggregatedDataValue( dataElement, null, period.getStartDate(), period.getEndDate(), organisationUnit );
             
-            if ( value != null )
-            { 
-                AggregatedMapValue mapValue = new AggregatedMapValue();
-                mapValue.setOrganisationUnitId( organisationUnit.getId() );
-                mapValue.setOrganisationUnitName( organisationUnit.getName() );
-                mapValue.setPeriodId( period.getId() );
-                mapValue.setValue( MathUtils.getRounded( value, 2 ) );
+            value = value != null ? value : 0; // TODO improve
+            
+            AggregatedMapValue mapValue = new AggregatedMapValue();
+            mapValue.setOrganisationUnitId( organisationUnit.getId() );
+            mapValue.setOrganisationUnitName( organisationUnit.getName() );
+            mapValue.setPeriodId( period.getId() );
+            mapValue.setValue( MathUtils.getRounded( value, 2 ) );
                 
-                values.add( mapValue );
-            }
+            values.add( mapValue );
         }
         
         return values;
@@ -232,16 +231,15 @@
         {
             Double value = aggregationService.getAggregatedIndicatorValue( indicator, period.getStartDate(), period.getEndDate(), organisationUnit );
             
-            if ( value != null )
-            {
-                AggregatedMapValue mapValue = new AggregatedMapValue();
-                mapValue.setOrganisationUnitId( organisationUnit.getId() );
-                mapValue.setOrganisationUnitName( organisationUnit.getName() );
-                mapValue.setPeriodId( period.getId() );
-                mapValue.setValue( MathUtils.getRounded( value, 2 ) );
+            value = value != null ? value : 0; // TODO improve
+            
+            AggregatedMapValue mapValue = new AggregatedMapValue();
+            mapValue.setOrganisationUnitId( organisationUnit.getId() );
+            mapValue.setOrganisationUnitName( organisationUnit.getName() );
+            mapValue.setPeriodId( period.getId() );
+            mapValue.setValue( MathUtils.getRounded( value, 2 ) );
                 
-                values.add( mapValue );
-            }
+            values.add( mapValue );
         }
         
         return values;