Skip to content

Commit

Permalink
fix: corrected false questionModel.answered condition from payload th…
Browse files Browse the repository at this point in the history
…at evaluated to truthy when payload was undefined
  • Loading branch information
KasperBaun committed Feb 27, 2024
1 parent b8805b3 commit b228410
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ function mapJsonQuestionToModelQuestion(key: string, question: QuestionJsonModel
const parseInputProperties = resolveQuickFormService("inputTypePropertiesTransformer");
const logger = resolveQuickFormService("logger");



if (question.inputType === "dropdown" && question.dataType === "boolean")
value = value === true ? 'Y' : value===false? 'N':'';
value = value === true ? 'Y' : value === false ? 'N' : '';


logger.log("Transforming Question {key}: {@question} with value {@value}", key, question, value);

return {
logicalName: question.logicalName ?? key,
inputType: question.inputType,
dataType: question.dataType??"string",
dataType: question.dataType ?? "string",
text: question.text,
placeholder: question.placeholder??'',
placeholder: question.placeholder ?? '',
paragraph: question.paragraph,
answered: typeof (value) !== undefined && value !== '',
inputProperties: parseInputProperties(question),
output: value ?? '',
answered: typeof (value) !== "undefined" && value !== '' && value !== null && value !== "",
inputProperties: parseInputProperties(question),
output: value ?? '',
} as QuestionModel;
}
registerQuickFormService("questionTransformer", mapJsonQuestionToModelQuestion);

0 comments on commit b228410

Please sign in to comment.