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

Fix option values for data versions #221

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ const getOptionValues = (optionIds, questionnaire) => {
const optionResults = optionIds.map((id) => {
const option = find(options, { id });

const optionContent = option.value
? option.value.trim()
: option.label.trim();
const optionContent =
questionnaire.dataVersion === "3" && option.value
? option.value.trim()
: option.label.trim();

const updatedContent = optionContent
.replace(/'/g, `\u2019`)
Expand Down
3 changes: 2 additions & 1 deletion src/eq_schema/schema/Answer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ class Answer {
{ properties, type },
ctx
) {
const optionValue = value ? value : label;
const optionValue =
ctx && ctx.questionnaireJson.dataVersion === "3" && value ? value : label;
const option = {
label: buildContents(label, ctx, true),
value: buildContents(optionValue, ctx, true),
Expand Down
Loading