← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5052: (DV) Bug fixed: Incorrect values when periods = filter.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5052 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-10-27 14:38:13 +0200
message:
  (DV) Bug fixed: Incorrect values when periods = filter.
removed:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonAggregatedIndicatorValue.vm
renamed:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonOrganisationUnitChildren.vm => dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminOrganisationUnitChildren.vm
modified:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedDataValuesAction.java
  dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedIndicatorValuesAction.java
  dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/sass/config.rb*
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/editor/tb-sprite.gif*
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/grid/dd-insert-arrow-left.png*
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/grid/dd-insert-arrow-right.png*
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/util/splitter/mini-bottom.gif*
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/util/splitter/mini-left.gif*
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/util/splitter/mini-right.gif*
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/util/splitter/mini-top.gif*


--
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-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedDataValuesAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedDataValuesAction.java	2011-10-23 12:03:50 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedDataValuesAction.java	2011-10-27 12:35:27 +0000
@@ -31,11 +31,6 @@
 
 import org.hisp.dhis.aggregation.AggregatedDataValue;
 import org.hisp.dhis.aggregation.AggregatedDataValueService;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.RelativePeriods;
-import org.hisp.dhis.system.util.ConversionUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -56,20 +51,6 @@
         this.aggregatedDataValueService = aggregatedDataValueService;
     }
 
-    private PeriodService periodService;
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-
-    private I18nFormat format;
-
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -81,6 +62,13 @@
         this.dataElementIds = dataElementIds;
     }
 
+    private Collection<Integer> periodIds;
+
+    public void setPeriodIds( Collection<Integer> periodIds )
+    {
+        this.periodIds = periodIds;
+    }
+
     private Collection<Integer> organisationUnitIds;
 
     public void setOrganisationUnitIds( Collection<Integer> organisationUnitIds )
@@ -88,69 +76,6 @@
         this.organisationUnitIds = organisationUnitIds;
     }
 
-    private boolean lastMonth;
-
-    public void setLastMonth( boolean lastMonth )
-    {
-        this.lastMonth = lastMonth;
-    }
-
-    private boolean lastQuarter;
-
-    public void setLastQuarter( boolean lastQuarter )
-    {
-        this.lastQuarter = lastQuarter;
-    }
-
-    private boolean monthsThisYear;
-
-    public void setMonthsThisYear( boolean monthsThisYear )
-    {
-        this.monthsThisYear = monthsThisYear;
-    }
-
-    private boolean quartersThisYear;
-
-    public void setQuartersThisYear( boolean quartersThisYear )
-    {
-        this.quartersThisYear = quartersThisYear;
-    }
-
-    private boolean thisYear;
-
-    public void setThisYear( boolean thisYear )
-    {
-        this.thisYear = thisYear;
-    }
-
-    private boolean monthsLastYear;
-
-    public void setMonthsLastYear( boolean monthsLastYear )
-    {
-        this.monthsLastYear = monthsLastYear;
-    }
-
-    private boolean quartersLastYear;
-
-    public void setQuartersLastYear( boolean quartersLastYear )
-    {
-        this.quartersLastYear = quartersLastYear;
-    }
-
-    private boolean lastYear;
-
-    public void setLastYear( boolean lastYear )
-    {
-        this.lastYear = lastYear;
-    }
-
-    private boolean lastFiveYears;
-
-    public void setLastFiveYears( boolean lastFiveYears )
-    {
-        this.lastFiveYears = lastFiveYears;
-    }
-
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -169,19 +94,10 @@
     public String execute()
         throws Exception
     {
-        if ( dataElementIds != null
-            && organisationUnitIds != null
-            && ( lastMonth || lastQuarter || monthsThisYear || quartersThisYear || thisYear
-                || monthsLastYear || quartersLastYear || lastYear || lastFiveYears ) )
+        if ( dataElementIds != null && periodIds != null && organisationUnitIds != null )
         {
-            RelativePeriods relativePeriod = new RelativePeriods( lastMonth, false, lastQuarter, monthsThisYear, quartersThisYear,
-                thisYear, monthsLastYear, quartersLastYear, lastYear, lastFiveYears, false, false );
-
-            Collection<Integer> relativePeriods = ConversionUtils.getIdentifiers( Period.class,
-                periodService.reloadPeriods( relativePeriod.getRelativePeriods( format, true ) ) );
-
-            object = aggregatedDataValueService.getAggregatedDataValues( dataElementIds, relativePeriods,
-                organisationUnitIds );
+            object = aggregatedDataValueService
+                .getAggregatedDataValues( dataElementIds, periodIds, organisationUnitIds );
         }
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedIndicatorValuesAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedIndicatorValuesAction.java	2011-10-23 12:03:50 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAggregatedIndicatorValuesAction.java	2011-10-27 12:35:27 +0000
@@ -31,11 +31,6 @@
 
 import org.hisp.dhis.aggregation.AggregatedDataValueService;
 import org.hisp.dhis.aggregation.AggregatedIndicatorValue;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.period.RelativePeriods;
-import org.hisp.dhis.system.util.ConversionUtils;
 
 import com.opensymphony.xwork2.Action;
 
@@ -56,20 +51,6 @@
         this.aggregatedDataValueService = aggregatedDataValueService;
     }
 
-    private PeriodService periodService;
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-
-    private I18nFormat format;
-
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -81,6 +62,13 @@
         this.indicatorIds = indicatorIds;
     }
 
+    private Collection<Integer> periodIds;
+
+    public void setPeriodIds( Collection<Integer> periodIds )
+    {
+        this.periodIds = periodIds;
+    }
+
     private Collection<Integer> organisationUnitIds;
 
     public void setOrganisationUnitIds( Collection<Integer> organisationUnitIds )
@@ -88,69 +76,6 @@
         this.organisationUnitIds = organisationUnitIds;
     }
 
-    private boolean lastMonth;
-
-    public void setLastMonth( boolean lastMonth )
-    {
-        this.lastMonth = lastMonth;
-    }
-
-    private boolean lastQuarter;
-
-    public void setLastQuarter( boolean lastQuarter )
-    {
-        this.lastQuarter = lastQuarter;
-    }
-
-    private boolean monthsThisYear;
-
-    public void setMonthsThisYear( boolean monthsThisYear )
-    {
-        this.monthsThisYear = monthsThisYear;
-    }
-
-    private boolean quartersThisYear;
-
-    public void setQuartersThisYear( boolean quartersThisYear )
-    {
-        this.quartersThisYear = quartersThisYear;
-    }
-
-    private boolean thisYear;
-
-    public void setThisYear( boolean thisYear )
-    {
-        this.thisYear = thisYear;
-    }
-
-    private boolean monthsLastYear;
-
-    public void setMonthsLastYear( boolean monthsLastYear )
-    {
-        this.monthsLastYear = monthsLastYear;
-    }
-
-    private boolean quartersLastYear;
-
-    public void setQuartersLastYear( boolean quartersLastYear )
-    {
-        this.quartersLastYear = quartersLastYear;
-    }
-
-    private boolean lastYear;
-
-    public void setLastYear( boolean lastYear )
-    {
-        this.lastYear = lastYear;
-    }
-
-    private boolean lastFiveYears;
-
-    public void setLastFiveYears( boolean lastFiveYears )
-    {
-        this.lastFiveYears = lastFiveYears;
-    }
-
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -169,18 +94,9 @@
     public String execute()
         throws Exception
     {
-        if ( indicatorIds != null
-            && organisationUnitIds != null
-            && ( lastMonth || lastQuarter || monthsThisYear || quartersThisYear || thisYear
-                || monthsLastYear || quartersLastYear || lastYear || lastFiveYears ) )
+        if ( indicatorIds != null && periodIds != null && organisationUnitIds != null )
         {
-            RelativePeriods relativePeriod = new RelativePeriods( lastMonth, false, lastQuarter, monthsThisYear, quartersThisYear,
-                thisYear, monthsLastYear, quartersLastYear, lastYear, lastFiveYears, false, false );
-
-            Collection<Integer> relativePeriods = ConversionUtils.getIdentifiers( Period.class,
-                periodService.reloadPeriods( relativePeriod.getRelativePeriods( format, true ) ) );
-
-            object = aggregatedDataValueService.getAggregatedIndicatorValues( indicatorIds, relativePeriods,
+            object = aggregatedDataValueService.getAggregatedIndicatorValues( indicatorIds, periodIds,
                 organisationUnitIds );
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml	2011-10-05 14:19:53 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml	2011-10-27 12:35:27 +0000
@@ -34,8 +34,6 @@
 		scope="prototype">
 		<property name="aggregatedDataValueService"
 			ref="org.hisp.dhis.aggregation.AggregatedDataValueService" />
-        <property name="periodService"
-            ref="org.hisp.dhis.period.PeriodService" />
 	</bean>
     
     <!-- AggregatedDataValue -->
@@ -45,8 +43,6 @@
         scope="prototype">
         <property name="aggregatedDataValueService"
             ref="org.hisp.dhis.aggregation.AggregatedDataValueService" />
-        <property name="periodService"
-            ref="org.hisp.dhis.period.PeriodService" />
     </bean>
 	
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml	2011-10-05 14:19:53 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml	2011-10-27 12:35:27 +0000
@@ -28,7 +28,7 @@
 		<action name="getOrganisationUnitChildren"
 			class="org.hisp.dhis.visualizer.action.GetOrganisationUnitChildrenAction">
 			<result name="success" type="velocity-json">
-				/dhis-web-visualizer/jsonOrganisationUnitChildren.vm</result>
+				/dhis-web-visualizer/jsonminOrganisationUnitChildren.vm</result>
 		</action>
 
         <!-- AggregatedIndicatorValue -->

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2011-10-26 12:13:44 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2011-10-27 12:35:27 +0000
@@ -259,7 +259,9 @@
                         cmp = DV.cmp.dimension.period;
                     for (var i = 0; i < cmp.length; i++) {
                         if (cmp[i].getValue()) {
-                            a.push(cmp[i].paramName + '=true');
+                            Ext.Array.each(DV.init.system.periods[cmp[i].paramName], function(item) {
+                                a.push('periodIds=' + item.id);
+                            });
                         }
                     }
                     return (isFilter && a.length > 1) ? a.slice(0,1) : a;
@@ -633,9 +635,9 @@
             params = params.concat(DV.util.dimension[filter].getUrl(true));
             
             var baseUrl = DV.conf.finals.ajax.url_visualizer + url + '.action';
-            for (var i = 0; i < params.length; i++) {
-                baseUrl = Ext.String.urlAppend(baseUrl, params[i]);
-            }
+            Ext.Array.each(params, function(item) {
+                baseUrl = Ext.String.urlAppend(baseUrl, item);
+            });
             
             Ext.Ajax.request({
                 url: baseUrl,
@@ -667,14 +669,14 @@
     DV.data = {
         data: [],        
         getData: function(exe) {
-            this.data = [];  
+            this.data = [];
 			
             Ext.Array.each(DV.state.category.data, function(item) {
                 var obj = {};
                 obj[DV.conf.finals.chart.x] = item;
                 DV.data.data.push(obj);
             });
-			
+            
             Ext.Array.each(DV.data.data, function(item) {
                 for (var i = 0; i < DV.state.series.data.length; i++) {
                     for (var j = 0; j < DV.value.values.length; j++) {

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/sass/config.rb' (properties changed: +x to -x)
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/editor/tb-sprite.gif' (properties changed: +x to -x)
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/grid/dd-insert-arrow-left.png' (properties changed: +x to -x)
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/grid/dd-insert-arrow-right.png' (properties changed: +x to -x)
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/util/splitter/mini-bottom.gif' (properties changed: +x to -x)
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/util/splitter/mini-left.gif' (properties changed: +x to -x)
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/util/splitter/mini-right.gif' (properties changed: +x to -x)
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/lib/ext/resources/themes/images/gray/util/splitter/mini-top.gif' (properties changed: +x to -x)
=== removed file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonAggregatedIndicatorValue.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonAggregatedIndicatorValue.vm	2011-09-08 22:42:45 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonAggregatedIndicatorValue.vm	1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
-#set( $size = $object.size() )
-{ "aggregatedIndicatorValues": [
-#foreach( $value in $object )
-  {
-    "id": "$!{indicator.id}",
-    "shortName": "$!encoder.jsonEncode( ${indicator.shortName} )"
-  }#if( $velocityCount < $size ),#end
-#end
-] }
\ No newline at end of file

=== renamed file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonOrganisationUnitChildren.vm' => 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminOrganisationUnitChildren.vm'