← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10222: Analytics, fixed bug

 

------------------------------------------------------------
revno: 10222
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-14 15:31:25 +0100
message:
  Analytics, fixed bug
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.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-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java	2013-03-10 16:13:56 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java	2013-03-14 14:31:25 +0000
@@ -214,9 +214,22 @@
         
         for ( DataQueryParams filterParams : params.getPartitionFilterParams() )
         {
-            sql += "select " + getCommaDelimitedString( filterParams.getQueryDimensions() ) + ", value as value ";
-            
-            sql += getFromWhereClause( filterParams );
+            sql += "select " + getCommaDelimitedString( filterParams.getQueryDimensions() ) + ", ";
+            
+            if ( params.isAggregationType( AVERAGE_INT ) )
+            {
+                sql += "daysxvalue";
+            }
+            else if ( params.isAggregationType( AVERAGE_BOOL ) )
+            {
+                sql += "daysxvalue, daysno";
+            }
+            else
+            {
+                sql += "value";
+            }
+            
+            sql += " " + getFromWhereClause( filterParams );
             
             sql += "union all ";
         }