← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14857: ER, multiple item fix.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 14857 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-14 22:15:01 +0200
message:
  ER, multiple item fix.
modified:
  dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/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/app.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js	2014-04-14 15:35:07 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js	2014-04-14 20:13:04 +0000
@@ -4903,7 +4903,8 @@
 				map = {},
 				columns = [],
 				rows = [],
-				filters = [];
+				filters = [],
+				a;
 
 			view.dataType = dataType;
             view.program = program.getRecord();
@@ -4924,56 +4925,66 @@
                 }
             }
             else if (periodMode.getValue() === 'periods') {
-				map['pe'] = periods.getDimension();
+				map['pe'] = [periods.getDimension()];
 			}
 
 			// ou
 
-			map['ou'] = treePanel.getDimension();
+			map['ou'] = [treePanel.getDimension()];
 
             // data items
 
             for (var i = 0, record; i < dataElementSelected.items.items.length; i++) {
                 record = dataElementSelected.items.items[i].getRecord();
 
-                map[record.dimension] = record;
+                map[record.dimension] = map[record.dimension] || [];
+
+                map[record.dimension].push(record);
             }
 
             // other
 
-            map['longitude'] = {dimension: 'longitude'};
-            map['latitude'] = {dimension: 'latitude'};
+            map['longitude'] = [{dimension: 'longitude'}];
+            map['latitude'] = [{dimension: 'latitude'}];
 
             // dimensions
 
             if (layoutWindow.colStore) {
 				layoutWindow.colStore.each(function(item) {
-					if (map[item.data.id]) {
-						columns.push(map[item.data.id]);
+					a = map[item.data.id] || [];
+
+					for (var i = 0; i < a.length; i++) {
+						columns.push(a[i]);
 					}
 				});
 			}
 
             if (layoutWindow.rowStore) {
 				layoutWindow.rowStore.each(function(item) {
-					if (map[item.data.id]) {
-						rows.push(map[item.data.id]);
+					a = map[item.data.id] || [];
+
+					for (var i = 0; i < a.length; i++) {
+						rows.push(a[i]);
 					}
 				});
 			}
 
             if (layoutWindow.filterStore) {
 				layoutWindow.filterStore.each(function(item) {
-					if (map[item.data.id]) {
-						filters.push(map[item.data.id]);
+					a = map[item.data.id] || [];
+
+					for (var i = 0; i < a.length; i++) {
+						filters.push(a[i]);
 					}
 				});
 			}
 
             if (layoutWindow.fixedFilterStore) {
 				layoutWindow.fixedFilterStore.each(function(item) {
-					if (map[item.data.id]) {
-						filters.push(map[item.data.id]);
+					a = map[item.data.id] || [];
+
+					for (var i = 0; i < a.length; i++) {
+						filters.push(a[i]);
 					}
 				});
 			}
@@ -5511,7 +5522,7 @@
                     if (view.sortOrder && view.topLimit) {
                         view.sorting = {
                             id: 1,
-                            direction: view.sortOrder > 0 ? 'DESC' : 'ASC'
+                            direction: view.sortOrder == 1 ? 'DESC' : 'ASC'
                         };
                     }
                 }

=== 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-04-13 15:52:00 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js	2014-04-14 20:13:04 +0000
@@ -1656,7 +1656,7 @@
 			service.response.query.getExtendedResponse = function(layout, response) {
 				var xResponse = Ext.clone(response),
 					metaData = xResponse.metaData,
-                    dimensionNames = Ext.Array.pluck(layout.columns, 'dimension'),
+                    dimensionNames = Ext.Array.unique(Ext.Array.pluck(layout.columns, 'dimension')),
                     dimensionHeaders = [],
 					headers = xResponse.headers,
 					nameHeaderMap = {},