Skip to content

Commit

Permalink
fix for mutually exclusive required (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
martyncolmer authored Aug 25, 2022
1 parent 5e67baf commit 81de5ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/eq_schema/schema/Question/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Question {
question.answers.some((answer) => answer.type === MUTUALLY_EXCLUSIVE)
) {
this.type = "MutuallyExclusive";
this.mandatory = false;
this.mandatory = question.answers[0].properties.required;
this.answers = this.buildMutuallyExclusiveAnswers(
mutuallyExclusive,
question.answers,
Expand Down Expand Up @@ -168,6 +168,7 @@ class Question {
buildMutuallyExclusiveAnswers(mutuallyExclusive, answers, ctx) {
let mutuallyExclusiveAnswer;
answers.forEach((answer) => {
answer.properties.required = false;
if (answer.type === MUTUALLY_EXCLUSIVE && answer.options.length === 1) {
answers = answers.filter(
(answer) => answer.type !== MUTUALLY_EXCLUSIVE
Expand Down

0 comments on commit 81de5ee

Please sign in to comment.