← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17417: minor change

 

------------------------------------------------------------
revno: 17417
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-11-11 14:01:33 +0545
message:
  minor change
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	2014-11-11 08:13:46 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/JdbcAnalyticsManager.java	2014-11-11 08:16:33 +0000
@@ -314,14 +314,18 @@
             {
                 String col = statementBuilder.columnQuote( dim.getDimensionName() );
 
+                List<String> periods;
+
                 if ( !calendar.isIso8601() && PERIOD_DIM_ID.equals( dim.getDimension() ) )
                 {
-                    sql += sqlHelper.whereAnd() + " " + col + " in (" + getQuotedCommaDelimitedString( getLocalPeriods( dim.getItems(), calendar ) ) + ") ";
+                    periods = getLocalPeriods( dim.getItems(), calendar );
                 }
                 else
                 {
-                    sql += sqlHelper.whereAnd() + " " + col + " in (" + getQuotedCommaDelimitedString( getUids( dim.getItems() ) ) + ") ";
+                    periods = getUids( dim.getItems() );
                 }
+
+                sql += sqlHelper.whereAnd() + " " + col + " in (" + getQuotedCommaDelimitedString( periods ) + ") ";
             }
         }
 
@@ -341,14 +345,18 @@
                     {
                         String col = statementBuilder.columnQuote( filter.getDimensionName() );
 
+                        List<String> periods;
+
                         if ( !calendar.isIso8601() && PERIOD_DIM_ID.equals( filter.getDimension() ) )
                         {
-                            sql += col + " in (" + getQuotedCommaDelimitedString( getLocalPeriods( filter.getItems(), calendar ) ) + ") or ";
+                            periods = getLocalPeriods( filter.getItems(), calendar );
                         }
                         else
                         {
-                            sql += col + " in (" + getQuotedCommaDelimitedString( getUids( filter.getItems() ) ) + ") or ";
+                            periods = getUids( filter.getItems() );
                         }
+
+                        sql += col + " in (" + getQuotedCommaDelimitedString( periods ) + ") or ";
                     }
                 }