← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1199: Removed the check for aggregation operator when finding dimension totals and subtotals. Did not c...

 

------------------------------------------------------------
revno: 1199
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Thu 2009-12-10 08:54:05 +0100
message:
  Removed the check for aggregation operator when finding dimension totals and subtotals. Did not cause wrong results but was unnessecary.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.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-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2009-12-09 17:32:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2009-12-10 07:54:05 +0000
@@ -149,7 +149,7 @@
     private List<OrganisationUnit> units = new ArrayList<OrganisationUnit>();
     
     /**
-     * The <a>org.hisp.dhis.dimension.DimensionType</a> for the ReportTable.
+     * The {@link org.hisp.dhis.dimension.DimensionType} for the ReportTable.
      */
     private DimensionType dimensionType;
     

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java	2009-12-01 18:47:16 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/jdbc/JdbcDataMartStore.java	2009-12-10 07:54:05 +0000
@@ -69,15 +69,6 @@
 public class JdbcDataMartStore
     implements DataMartStore
 {
-    private static final Map<String, String> functionMap = new HashMap<String, String>();
-    
-    static
-    {
-        functionMap.put( DataElement.AGGREGATION_OPERATOR_SUM, "SUM" );
-        functionMap.put( DataElement.AGGREGATION_OPERATOR_AVERAGE, "AVG" );
-        functionMap.put( DataElement.AGGREGATION_OPERATOR_COUNT, "SUM" );
-    }
-    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -103,7 +94,7 @@
     public Double getAggregatedValue( DataElement dataElement, Period period, OrganisationUnit organisationUnit )
     {
         final String sql = 
-            "SELECT " + functionMap.get( dataElement.getAggregationOperator() ) + "(value) " +
+            "SELECT SUM(value) " +
             "FROM aggregateddatavalue " +
             "WHERE dataelementid = " + dataElement.getId() + " " +
             "AND periodid = " + period.getId() + " " +
@@ -119,7 +110,7 @@
             String ids = getCommaDelimitedString( getIdentifiers( DataElementCategoryOptionCombo.class, dimensionOption.getDimensionOptionElements() ) );
             
             final String sql =
-                "SELECT " + functionMap.get( dataElement.getAggregationOperator() ) + "(value) " +
+                "SELECT SUM(value) " +
                 "FROM aggregateddatavalue " +
                 "WHERE dataelementid = " + dataElement.getId() + " " +
                 "AND categoryoptioncomboid IN (" + ids + ") " +

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java	2009-12-01 18:47:16 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/jdbc/JDBCReportTableManager.java	2009-12-10 07:54:05 +0000
@@ -150,7 +150,7 @@
         {
             ResultSet resultSet = holder.getStatement().executeQuery( statement.getStatement() );
             
-            log.debug( "Get values statement: " + statement.getStatement() );
+            log.info( "Get values statement: " + statement.getStatement() );
             
             int columnCount = resultSet.getMetaData().getColumnCount(); //TODO improve performance?