Skip to content

Commit

Permalink
Merge pull request #566 from ChildMindInstitute/release/2025.01.1
Browse files Browse the repository at this point in the history
fix: match single/multi selection option via it's value instead of in…
  • Loading branch information
mbanting authored Jan 14, 2025
2 parents 3e08d19 + e2b7ced commit f745b52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Action Plan', () => {
name,
responseType: type,
responseValues: {
options: options.map((option) => ({ text: option })),
options: options.map((option, value) => ({ text: option, value })),
},
answer,
}) as never as ItemRecord;
Expand Down
8 changes: 6 additions & 2 deletions src/entities/activity/ui/items/ActionPlan/phrasalData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ export const extractActivitiesPhrasalData = (items: ItemRecord[]): ActivitiesPhr
const selectFieldData: ActivityPhrasalArrayFieldData = {
type: 'array',
values: item.answer
.map((value) => item.responseValues.options[parseInt(value, 10)]?.text)
.filter((value) => !!value),
.map(
(value) =>
item.responseValues.options.find((option) => option.value === parseInt(value, 10))
?.text,
)
.filter((value): value is string => !!value),
context: fieldDataContext,
};
fieldData = selectFieldData;
Expand Down

0 comments on commit f745b52

Please sign in to comment.