← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15611: ER, sorting bug fixed + EV, layout.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 15611 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-06-10 18:32:58 +0200
message:
  ER, sorting bug fixed + EV, layout.
modified:
  dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js


--
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-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js	2014-06-02 12:31:21 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js	2014-06-10 16:30:53 +0000
@@ -1619,7 +1619,7 @@
 								// number sorting
                                 objects.push({
                                     id: fullId,
-                                    sortingId: parsedId || Number.MAX_VALUE
+                                    sortingId: Ext.isNumber(parsedId) ? parsedId : Number.MAX_VALUE
                                 });
                             }
 
@@ -1652,7 +1652,7 @@
 
 								objects.push({
 									id: fullId,
-									sortingId: name
+									sortingId: header.name === 'pe' ? fullId : name
 								});
                             }
 

=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js	2014-06-06 10:11:04 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js	2014-06-10 16:30:53 +0000
@@ -4635,7 +4635,7 @@
             }
 
 			// pe
-
+            
             if (periodMode.getValue() === 'dates') {
                 view.startDate = startDate.getSubmitValue();
                 view.endDate = endDate.getSubmitValue();
@@ -5431,11 +5431,9 @@
                     xColAxis,
                     xRowAxis,
                     chart,
-                    //getHtml,
                     getXLayout = service.layout.getExtendedLayout,
                     getSXLayout = service.layout.getSyncronizedXLayout,
                     getXResponse = service.response.aggregate.getExtendedResponse;
-                    //getXAxis = service.layout.getExtendedAxis;
 
                 response = response || ns.app.response;
 
@@ -5774,16 +5772,17 @@
 		});
 
 		update = function() {
-			var config = ns.core.web.report.getLayoutConfig();
+			var config = ns.core.web.report.getLayoutConfig(),
+                layout = ns.core.api.layout.Layout(config);
 
-			if (!config) {
+			if (!layout) {
 				return;
 			}
 
 			// state
             ns.app.viewport.getLayoutWindow().saveState();
 
-			ns.core.web.report.getData(config, false);
+			ns.core.web.report.getData(layout, false);
 		};
 
 		westRegion = Ext.create('Ext.panel.Panel', {

=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js	2014-06-05 15:00:36 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js	2014-06-10 16:30:53 +0000
@@ -499,6 +499,11 @@
 					layout.rows = config.rows;
 					layout.filters = config.filters;
 
+                    if (config.startDate && config.endDate) {
+                        layout.startDate = config.startDate;
+                        layout.endDate = config.endDate;
+                    }
+
 					// properties
                     layout.showValues = Ext.isBoolean(config.showData) ? config.showData : (Ext.isBoolean(config.showValues) ? config.showValues : true);
                     layout.hideEmptyRows = Ext.isBoolean(config.hideEmptyRows) ? config.hideEmptyRows : (Ext.isBoolean(config.hideEmptyRows) ? config.hideEmptyRows : true);
@@ -1678,7 +1683,7 @@
 								// number sorting
                                 objects.push({
                                     id: fullId,
-                                    sortingId: parsedId
+                                    sortingId: Ext.isNumber(parsedId) ? parsedId : Number.MAX_VALUE
                                 });
                             }
 
@@ -1711,7 +1716,7 @@
 
 								objects.push({
 									id: fullId,
-									sortingId: name
+									sortingId: header.name === 'pe' ? fullId : name
 								});
                             }
 
@@ -2493,8 +2498,12 @@
                             'NE': '!='
                         };
 
+                    if (xLayout.startDate && xLayout.endDate) {
+                        text = xLayout.startDate + ' - ' + xLayout.endDate;
+                    }
+
                     if (xLayout.title) {
-                        text = xLayout.title;
+                        text += (text.length ? ', ' : '') + xLayout.title;
                     }
                     else if (xLayout.type === conf.finals.chart.pie) {
                         var ids = Ext.Array.clean([].concat(columnIds || []));
@@ -2508,65 +2517,67 @@
                     }
                     else {
                         var meta = ['pe', 'ou'];
-                        
-                        for (var i = 0, dim; i < layout.filters.length; i++) {
-                            dim = layout.filters[i];
-                            text += (text.length ? ', ' : '');
-
-                            if (Ext.Array.contains(meta, dim.dimension)) {
-                                var ids = xResponse.metaData[dim.dimension],
-                                tmpText = '';
-                                
-                                for (var ii = 0; ii < ids.length; ii++) {
-                                    tmpText += (tmpText.length ? ', ' : '') + names[ids[ii]];
-                                }
-
-                                text += tmpText;
-                            }
-                            else {
-                                if (dim.filter) {
-                                    var a = dim.filter.split(':');
+
+                        if (layout.filters) {
+                            for (var i = 0, dim; i < layout.filters.length; i++) {
+                                dim = layout.filters[i];
+                                text += (text.length ? ', ' : '');
+
+                                if (Ext.Array.contains(meta, dim.dimension)) {
+                                    var ids = xResponse.metaData[dim.dimension],
+                                    tmpText = '';
                                     
-                                    if (a.length === 2) {
-                                        var operator = a[0],
-                                            valueArray = a[1].split(';'),
-                                            tmpText = '';
-
-                                        if (operator === 'IN') {
-                                            for (var ii = 0; ii < valueArray.length; ii++) {
-                                                tmpText += (tmpText.length ? ', ' : '') + valueArray[ii];
+                                    for (var ii = 0; ii < ids.length; ii++) {
+                                        tmpText += (tmpText.length ? ', ' : '') + names[ids[ii]];
+                                    }
+
+                                    text += tmpText;
+                                }
+                                else {
+                                    if (dim.filter) {
+                                        var a = dim.filter.split(':');
+                                        
+                                        if (a.length === 2) {
+                                            var operator = a[0],
+                                                valueArray = a[1].split(';'),
+                                                tmpText = '';
+
+                                            if (operator === 'IN') {
+                                                for (var ii = 0; ii < valueArray.length; ii++) {
+                                                    tmpText += (tmpText.length ? ', ' : '') + valueArray[ii];
+                                                }
+
+                                                text += tmpText;
+                                            }
+                                            else {
+                                                text += names[dim.dimension] + ' ' + operatorMap[operator] + ' ' + a[1];
+                                            }
+                                        }
+                                        else {
+                                            var operators = [],
+                                                values = [],
+                                                tmpText = '';
+
+                                            for (var ii = 0; ii < a.length; ii++) {
+                                                if (ii % 2) {
+                                                    values.push(a[ii]);
+                                                }
+                                                else {
+                                                    operators.push(a[ii]);
+                                                }
+                                            }
+
+                                            for (var ii = 0; ii < operators.length; ii++) {
+                                                tmpText += (tmpText.length ? ', ' : '') + names[dim.dimension] + ' ' + (operatorMap[operators[ii]] || '') + ' ' + values[ii];
                                             }
 
                                             text += tmpText;
                                         }
-                                        else {
-                                            text += names[dim.dimension] + ' ' + operatorMap[operator] + ' ' + a[1];
-                                        }
                                     }
                                     else {
-                                        var operators = [],
-                                            values = [],
-                                            tmpText = '';
-
-                                        for (var ii = 0; ii < a.length; ii++) {
-                                            if (ii % 2) {
-                                                values.push(a[ii]);
-                                            }
-                                            else {
-                                                operators.push(a[ii]);
-                                            }
-                                        }
-
-                                        for (var ii = 0; ii < operators.length; ii++) {
-                                            tmpText += (tmpText.length ? ', ' : '') + names[dim.dimension] + ' ' + (operatorMap[operators[ii]] || '') + ' ' + values[ii];
-                                        }
-
-                                        text += tmpText;
+                                        text += names[dim.dimension];
                                     }
                                 }
-                                else {
-                                    text += names[dim.dimension];
-                                }
                             }
                         }
                     }