dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31473
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16037: make sure that optionset uid list is unique, so we don't try and load same optionset multiple times
------------------------------------------------------------
revno: 16037
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-07-09 12:13:22 +0700
message:
make sure that optionset uid list is unique, so we don't try and load same optionset multiple times
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2014-07-09 05:04:06 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2014-07-09 05:13:22 +0000
@@ -2566,7 +2566,7 @@
*/
dhis2.de.getOptions = function( uid, query, success )
{
- $.ajax( {
+ return $.ajax( {
url: '../api/optionSets/' + uid + '.json?links=false&q=' + query,
dataType: "json",
cache: false,
@@ -2587,7 +2587,10 @@
*/
dhis2.de.loadOptionSets = function()
{
- var options = _.values( dhis2.de.optionSets ); // Array of objects with uid and v
+ var options = _.uniq( _.values( dhis2.de.optionSets ), function( item ) {
+ return item.uid;
+ }); // Array of objects with uid and v
+
var uids = [];
var deferred = $.Deferred();