From b38615eff7abdc2aa6edb5fa003b4e9117ecf458 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 3 Sep 2015 12:19:42 -0400 Subject: [PATCH] fixed duplicate choices from being passed to select2 --- .../src/job-templates/survey-maker/surveys/init.factory.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/awx/ui/client/src/job-templates/survey-maker/surveys/init.factory.js b/awx/ui/client/src/job-templates/survey-maker/surveys/init.factory.js index 9f0cf8ea1f..31e584b946 100644 --- a/awx/ui/client/src/job-templates/survey-maker/surveys/init.factory.js +++ b/awx/ui/client/src/job-templates/survey-maker/surveys/init.factory.js @@ -434,6 +434,11 @@ export default } data.choices = (scope.type.type === "multiplechoice") ? scope.choices : (scope.type.type === 'multiselect') ? scope.choices : "" ; + if (data.choices !== "") { + // remove duplicates from the choices + data.choices = _.uniq(data.choices.split("\n")).join("\n"); + } + Wait('stop'); if(scope.mode === 'add' || scope.mode==="edit" && scope.can_edit === true){ $('#survey-save-button').removeAttr('disabled');