Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EAR 1948 add option values for rad cb sel answers #182

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ const getOptionValues = (optionIds, questionnaire) => {
const optionResults = optionIds.map((id) => {
const option = find(options, { id });

const updatedLabel = option.label
const optionContent = option.value
? option.value.trim()
: option.label.trim();

const updatedContent = optionContent
.replace(/'/g, `\u2019`)
.replace(/'/g, `\u2019`)
.replace(/‘/g, `\u2019`);

return updatedLabel.trim();
return updatedContent.trim();
});

if (optionResults === undefined || optionResults.length < 0) {
Expand Down
6 changes: 4 additions & 2 deletions src/eq_schema/schema/Answer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,14 @@ class Answer {
}

static buildOption(
{ label, description, additionalAnswer, qCode: q_code },
{ label, description, additionalAnswer, qCode: q_code, value },
{ properties, type },
ctx
) {
const optionValue = value ? value : label;
const option = {
label: buildContents(label, ctx, true),
value: buildContents(label, ctx, true),
value: buildContents(optionValue, ctx, true),
};

if (q_code) {
Expand All @@ -279,6 +280,7 @@ class Answer {
}
}
}

return option;
}
}
Expand Down
Loading