← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18875: Relative periods upgrade fix

 

------------------------------------------------------------
revno: 18875
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-04-10 10:32:41 +0200
message:
  Relative periods upgrade fix
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.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/DataQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2015-04-09 20:49:51 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java	2015-04-10 08:32:41 +0000
@@ -412,6 +412,22 @@
     }
 
     /**
+     * Removes the dimensions with the given identifiers.
+     */
+    public DataQueryParams removeDimensions( String... dimension )
+    {
+        if ( dimension != null )
+        {
+            for ( String dim : dimension )
+            {
+                this.dimensions.remove( new BaseDimensionalObject( dim ) );
+            }
+        }            
+        
+        return this;
+    }
+
+    /**
      * Removes the dimension or filter with the given identifier.
      */
     public DataQueryParams removeDimensionOrFilter( String dimension )

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2015-04-09 20:49:51 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2015-04-10 08:32:41 +0000
@@ -1243,9 +1243,7 @@
      */
     private DataQueryParams getQueryIndicatorsReplacedByDataElements( DataQueryParams params, int indicatorIndex )
     {
-        DataQueryParams dataSourceParams = params.instance();
-        dataSourceParams.removeDimension( DATAELEMENT_DIM_ID );
-        dataSourceParams.removeDimension( DATASET_DIM_ID );
+        DataQueryParams dataSourceParams = params.instance().removeDimensions( DATAELEMENT_DIM_ID, DATASET_DIM_ID );
         
         List<Indicator> indicators = asTypedList( dataSourceParams.getIndicators() );
         List<NameableObject> dataElements = asList( expressionService.getDataElementsInIndicators( indicators ) );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-04-08 23:26:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-04-10 08:32:41 +0000
@@ -851,6 +851,12 @@
         executeSql( "update relativeperiods set thisquarter = false where thisquarter is null" );
         executeSql( "update relativeperiods set thissixmonth = false where thissixmonth is null" );
         executeSql( "update relativeperiods set thisweek = false where thisweek is null" );
+
+        executeSql( "update relativeperiods set lastmonth = false where lastmonth is null" );
+        executeSql( "update relativeperiods set lastbimonth = false where lastbimonth is null" );
+        executeSql( "update relativeperiods set lastquarter = false where lastquarter is null" );
+        executeSql( "update relativeperiods set lastsixmonth = false where lastsixmonth is null" );
+        executeSql( "update relativeperiods set lastweek = false where lastweek is null" );
     }
     
     private void upgradeDataValuesWithAttributeOptionCombo()