=== 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;