← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17301: ER option bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 17301 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-10-28 13:50:34 +0100
message:
  ER option bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/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-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2014-10-28 11:13:01 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2014-10-28 12:49:51 +0000
@@ -6433,6 +6433,7 @@
                         if (optionSetHeaders.length) {
                             var callbacks = 0,
                                 optionMap = {},
+                                getOptions,
                                 fn;
 
                             fn = function() {
@@ -6443,16 +6444,20 @@
                                 }
                             };
 
+                            getOptions = function(optionSetId, dataElementId) {
+                                dhis2.er.store.get('optionSets', optionSetId).done( function(obj) {
+                                    Ext.apply(optionMap, support.prototype.array.getObjectMap(obj.options, 'code', 'name', dataElementId));
+                                    fn();
+                                });
+                            };
+
                             // execute
-                            for (var i = 0, header; i < optionSetHeaders.length; i++) {
+                            for (var i = 0, header, optionSetId, dataElementId; i < optionSetHeaders.length; i++) {
                                 header = optionSetHeaders[i];
                                 optionSetId = header.optionSet;
                                 dataElementId = header.name;
 
-                                dhis2.er.store.get('optionSets', optionSetId).done( function(obj) {
-                                    Ext.apply(optionMap, support.prototype.array.getObjectMap(obj.options, 'code', 'name', dataElementId));
-                                    fn();
-                                });
+                                getOptions(optionSetId, dataElementId);
                             }
                         }
                         else {

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js	2014-10-28 11:13:01 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js	2014-10-28 12:49:51 +0000
@@ -744,7 +744,7 @@
                 for (var i = 0, obj; i < array.length; i++) {
                     obj = array[i];
 
-                    o[namePrefix + obj[idProperty]] = obj[nameProperty] + " WORKS";
+                    o[namePrefix + obj[idProperty]] = obj[nameProperty];
                 }
 
                 return o;
@@ -971,7 +971,7 @@
 					return name;
 				}
 
-				name += metaData.names[id] || metaData.optionNames[id];
+				name += metaData.optionNames[id] || metaData.names[id];
 
 				return name;
 			};
@@ -1754,8 +1754,8 @@
                 ouHierarchy = response.metaData.ouHierarchy,
                 names = response.metaData.names;
                 names[emptyId] = emptyId;
+
                 response.metaData.optionNames = {};
-
 				response.nameHeaderMap = {};
 				response.idValueMap = {};