← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19677: Program indicator analytics fix

 

------------------------------------------------------------
revno: 19677
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-07-19 17:50:46 +0200
message:
  Program indicator analytics fix
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java
  dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java
  dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java
  dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm


--
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/event/data/JdbcEventAnalyticsManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java	2015-07-12 15:01:19 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/JdbcEventAnalyticsManager.java	2015-07-19 15:50:46 +0000
@@ -516,7 +516,9 @@
 
         if ( params.hasFilterExpression() && ValidationUtils.expressionIsValidSQl( params.getFilterExpression() ) )
         {
-            sql += "and (" + ExpressionUtils.asSql( params.getFilterExpression() ) + ") ";
+            String sqlFilter = ExpressionUtils.asSql( params.getFilterExpression() );
+            
+            sql += "and (" + sqlFilter + ") ";
         }
         
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java'
--- dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java	2015-07-14 09:49:07 +0000
+++ dhis-2/dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/util/ExpressionUtils.java	2015-07-19 15:50:46 +0000
@@ -64,14 +64,8 @@
         EL_SQL_MAP.put( "&&", "and" );
         EL_SQL_MAP.put( "\\|\\|", "or" );
         EL_SQL_MAP.put( "==", "=" );
-        EL_SQL_MAP.put( "eq", "=" );
-        EL_SQL_MAP.put( "ne", "!=" );
-        EL_SQL_MAP.put( "lt", "<" );
-        EL_SQL_MAP.put( "le", "<=" );
-        EL_SQL_MAP.put( "gt", ">" );
-        EL_SQL_MAP.put( "ge", ">=" );
-        EL_SQL_MAP.put( "div", "/" );
-        EL_SQL_MAP.put( "mod", "%" );
+        
+        //TODO Add support for textual operators like eq, ne and lt
     }
     
     /**

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java	2015-07-10 19:12:53 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ExpressionUtilsTest.java	2015-07-19 15:50:46 +0000
@@ -142,11 +142,7 @@
         assertEquals( "2 > 1 and 3 < 4", ExpressionUtils.asSql( "2 > 1 && 3 < 4" ) );
         assertEquals( "2 > 1 or 3 < 4", ExpressionUtils.asSql( "2 > 1 || 3 < 4" ) );
         assertEquals( "'a' = 1", ExpressionUtils.asSql( "'a' == 1" ) );
-        assertEquals( "'a' = 3", ExpressionUtils.asSql( "'a' eq 3" ) );
-        assertEquals( "5 != 3", ExpressionUtils.asSql( "5 ne 3" ) );
-        assertEquals( "2 < 3", ExpressionUtils.asSql( "2 lt 3" ) );
-        assertEquals( "10 / 2", ExpressionUtils.asSql( "10 div 2" ) );
-        assertEquals( "10 % 2", ExpressionUtils.asSql( "10 mod 2" ) );
+        assertEquals( "\"oZg33kd9taw\" = 'Female'", ExpressionUtils.asSql( "\"oZg33kd9taw\" == 'Female'" ) );
     }
         
     @Test

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java	2015-07-12 15:01:19 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ValidationUtilsTest.java	2015-07-19 15:50:46 +0000
@@ -195,5 +195,7 @@
         assertTrue( expressionIsValidSQl( "\"abcdef12345\" < 30" ) );
         assertTrue( expressionIsValidSQl( "\"abcdef12345\" >= \"bcdefg23456\"" ) );
         assertTrue( expressionIsValidSQl( "\"DO0v7fkhUNd\" > -30000 and \"DO0v7fkhUNd\" < 30000" ) );
+        assertTrue( expressionIsValidSQl( "\"oZg33kd9taw\" == 'Female'" ) );
+        assertTrue( expressionIsValidSQl( "\"oZg33kd9taw\" == 'Female' and \"qrur9Dvnyt5\" <= 5" ) );
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm	2015-07-14 09:34:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm	2015-07-19 15:50:46 +0000
@@ -149,7 +149,7 @@
 	</tr>
 	<tr>
 		<td><div class="message message-info" style="margin-top:10px">The filter is applied to events and filters the data source used for the calculation of the indicator.
-			The filter must evaluate to either true or false. Use single quotes for text values.</div></td> 
+			The filter must evaluate to either true or false. Use single quotes for text values. Use option codes for option set references.</div></td> 
 	</tr>	
 	<tr>
 		<td>