diff --git a/src/components/Componentes/question-answer-storage.tsx b/src/components/Componentes/question-answer-storage.tsx index ec54f08..3a52c92 100644 --- a/src/components/Componentes/question-answer-storage.tsx +++ b/src/components/Componentes/question-answer-storage.tsx @@ -136,7 +136,17 @@ function createQuestionField( if (Array.isArray(value)) { option_id = value; } else if (typeof value === "string" && value) { - const selectedOpt = question.options.find((opt) => opt.id === value || opt.value === value); + const strVal = value.trim().toLowerCase(); + const selectedOpt = question.options.find( + (opt) => + opt.id === value || + opt.value === value || + opt.label === value || + opt.id.toLowerCase() === strVal || + (typeof opt.value === "string" && opt.value.toLowerCase() === strVal) || + (typeof opt.label === "string" && opt.label.toLowerCase() === strVal) || + opt.id.toLowerCase().endsWith(`.${strVal}`) + ); option_id = selectedOpt ? selectedOpt.id : value; } }