diff --git a/d2-tracker/dhis2.angular.services.js b/d2-tracker/dhis2.angular.services.js index df5bb698d..bf6be8ae0 100644 --- a/d2-tracker/dhis2.angular.services.js +++ b/d2-tracker/dhis2.angular.services.js @@ -451,16 +451,13 @@ var d2Services = angular.module('d2Services', ['ngResource']) const keyString = String(key); // is key a name? - for(var i=0; i keyString === option.displayName); + if (option) { + return option.code; } // is key a code? - for(var i=0; i keyString === option.code)) { + return key; } // not a part of the option set return null; @@ -474,16 +471,13 @@ var d2Services = angular.module('d2Services', ['ngResource']) const keyString = String(key); // is key a code? - for(var i=0; i keyString === option.code); + if (option) { + return option.displayName; } // is key a name? - for(var i=0; i keyString === option.displayName)) { + return key; } // not a part of the option set return null;