=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java' --- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java 2011-05-31 20:50:19 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java 2011-09-24 21:19:26 +0000 @@ -147,10 +147,7 @@ } catch ( NumberFormatException ex ) { - log.warn( "Value skipped, not numeric: '" + entry.getValue() + - "', for data element with id: '" + entry.getKey() + - "', for period with id: '" + crossTabValue.getPeriodId() + - "', for source with id: '" + crossTabValue.getSourceId() + "'" ); + log.warn( "Value skipped, not numeric: '" + entry.getValue() ); continue; } === modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntSingleValueAggregator.java' --- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntSingleValueAggregator.java 2011-05-31 20:50:19 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntSingleValueAggregator.java 2011-09-24 21:19:26 +0000 @@ -114,50 +114,30 @@ for ( final CrossTabDataValue crossTabValue : crossTabValues ) { - final Period period = aggregationCache.getPeriod( crossTabValue.getPeriodId() ); - - final Date currentStartDate = period.getStartDate(); - final Date currentEndDate = period.getEndDate(); - final int dataValueLevel = aggregationCache.getLevelOfOrganisationUnit( crossTabValue.getSourceId() ); - final double duration = getDaysInclusive( currentStartDate, currentEndDate ); - - if ( duration > 0 ) - { - for ( final Entry entry : crossTabValue.getValueMap().entrySet() ) // + for ( final Entry entry : crossTabValue.getValueMap().entrySet() ) // + { + if ( entry.getValue() != null && entry.getKey().aggregationLevelIsValid( unitLevel, dataValueLevel ) ) { - if ( entry.getValue() != null && entry.getKey().aggregationLevelIsValid( unitLevel, dataValueLevel ) ) - { - double value = 0.0; - double relevantDays = 0.0; - - try - { - value = Double.parseDouble( entry.getValue() ); - } - catch ( NumberFormatException ex ) - { - log.warn( "Value skipped, not numeric: '" + entry.getValue() + - "', for data element with id: '" + entry.getKey() + - "', for period with id: '" + crossTabValue.getPeriodId() + - "', for source with id: '" + crossTabValue.getSourceId() + "'" ); - continue; - } - - if ( currentStartDate.compareTo( endDate ) <= 0 && currentEndDate.compareTo( startDate ) >= 0 ) // Value is intersecting - { - relevantDays = getDaysInclusive( startDate, endDate ); - } + double value = 0.0; + double relevantDays = getDaysInclusive( startDate, endDate ); + + try + { + value = Double.parseDouble( entry.getValue() ); + } + catch ( NumberFormatException ex ) + { + log.warn( "Value skipped, not numeric: '" + entry.getValue() ); + continue; + } - final double[] totalSum = totalSums.get( entry.getKey() ); - value += totalSum != null ? totalSum[0] : 0; - relevantDays += totalSum != null ? totalSum[1] : 0; - - final double[] values = { value, relevantDays }; - - totalSums.put( entry.getKey(), values ); - } + final double[] totalSum = totalSums.get( entry.getKey() ); + value += totalSum != null ? totalSum[0] : 0; + relevantDays += totalSum != null ? totalSum[1] : 0; + final double[] values = { value, relevantDays }; + totalSums.put( entry.getKey(), values ); } } } === modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java' --- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java 2011-09-24 20:57:32 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java 2011-09-24 21:19:26 +0000 @@ -29,7 +29,6 @@ import static org.hisp.dhis.dataelement.DataElement.AGGREGATION_OPERATOR_SUM; import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_BOOL; -import static org.hisp.dhis.system.util.DateUtils.getDaysInclusive; import static org.hisp.dhis.system.util.MathUtils.getFloor; import java.util.Collection; @@ -111,33 +110,23 @@ for ( final CrossTabDataValue crossTabValue : crossTabValues ) { - final Period period = aggregationCache.getPeriod( crossTabValue.getPeriodId() ); - - final Date currentStartDate = period.getStartDate(); - final Date currentEndDate = period.getEndDate(); - - final double duration = getDaysInclusive( currentStartDate, currentEndDate ); - final int dataValueLevel = aggregationCache.getLevelOfOrganisationUnit( crossTabValue.getSourceId() ); - if ( duration > 0 ) + for ( final Entry entry : crossTabValue.getValueMap().entrySet() ) // { - for ( final Entry entry : crossTabValue.getValueMap().entrySet() ) // + if ( entry.getValue() != null && entry.getKey().aggregationLevelIsValid( unitLevel, dataValueLevel ) ) { - if ( entry.getValue() != null && entry.getKey().aggregationLevelIsValid( unitLevel, dataValueLevel ) ) + double value = 0.0; + + if ( entry.getValue().toLowerCase().equals( TRUE ) ) { - double value = 0.0; - - if ( entry.getValue().toLowerCase().equals( TRUE ) ) - { - value = 1; - } - - final double[] totalSum = totalSums.get( entry.getKey() ); - value += totalSum != null ? totalSum[0] : 0; - final double[] values = { value, 0 }; - totalSums.put( entry.getKey(), values ); + value = 1; } + + final double[] totalSum = totalSums.get( entry.getKey() ); + value += totalSum != null ? totalSum[0] : 0; + final double[] values = { value, 0 }; + totalSums.put( entry.getKey(), values ); } } } === modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java' --- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java 2011-09-24 20:57:32 +0000 +++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java 2011-09-24 21:19:26 +0000 @@ -29,7 +29,6 @@ import static org.hisp.dhis.dataelement.DataElement.AGGREGATION_OPERATOR_SUM; import static org.hisp.dhis.dataelement.DataElement.VALUE_TYPE_INT; -import static org.hisp.dhis.system.util.DateUtils.getDaysInclusive; import java.util.Collection; import java.util.Date; @@ -114,41 +113,28 @@ for ( final CrossTabDataValue crossTabValue : crossTabValues ) { - final Period period = aggregationCache.getPeriod( crossTabValue.getPeriodId() ); - - final Date currentStartDate = period.getStartDate(); - final Date currentEndDate = period.getEndDate(); - - final double duration = getDaysInclusive( currentStartDate, currentEndDate ); - final int dataValueLevel = aggregationCache.getLevelOfOrganisationUnit( crossTabValue.getSourceId() ); - if ( duration > 0 ) + for ( final Entry entry : crossTabValue.getValueMap().entrySet() ) // { - for ( final Entry entry : crossTabValue.getValueMap().entrySet() ) // + if ( entry.getValue() != null && entry.getKey().aggregationLevelIsValid( unitLevel, dataValueLevel ) ) { - if ( entry.getValue() != null && entry.getKey().aggregationLevelIsValid( unitLevel, dataValueLevel ) ) - { - double value = 0.0; - - try - { - value = Double.parseDouble( entry.getValue() ); - } - catch ( NumberFormatException ex ) - { - log.warn( "Value skipped, not numeric: '" + entry.getValue() + - "', for data element with id: '" + entry.getKey() + - "', for period with id: '" + crossTabValue.getPeriodId() + - "', for source with id: '" + crossTabValue.getSourceId() + "'" ); - continue; - } - - final double[] totalSum = totalSums.get( entry.getKey() ); - value += totalSum != null ? totalSum[0] : 0; - final double[] values = { value, 0 }; - totalSums.put( entry.getKey(), values ); - } + double value = 0.0; + + try + { + value = Double.parseDouble( entry.getValue() ); + } + catch ( NumberFormatException ex ) + { + log.warn( "Value skipped, not numeric: '" + entry.getValue() ); + continue; + } + + final double[] totalSum = totalSums.get( entry.getKey() ); + value += totalSum != null ? totalSum[0] : 0; + final double[] values = { value, 0 }; + totalSums.put( entry.getKey(), values ); } } }