@@ -6,6 +6,7 @@ const { getValueSource } = require("../../valueSource");
6
6
const { getListFromAll } = require ( "../../../../utils/functions/listGetters" ) ;
7
7
8
8
const { flatMap, filter, find } = require ( "lodash" ) ;
9
+ const { getAnswerById } = require ( "../../../../utils/functions/answerGetters" ) ;
9
10
10
11
const authorConditions = {
11
12
UNANSWERED : "Unanswered" ,
@@ -122,16 +123,30 @@ const buildAnswerObject = (
122
123
return SelectedOptions ;
123
124
}
124
125
125
- if ( condition === "OneOf" ) {
126
- const swapOptionValues = ( [ optionValues [ 0 ] , optionValues [ 1 ] ] = [
127
- optionValues [ 1 ] ,
128
- optionValues [ 0 ] ,
129
- ] ) ;
130
- const SelectedOptions = {
131
- [ routingConditionConversion ( condition ) ] : swapOptionValues ,
132
- } ;
126
+ const leftSideAnswer = getAnswerById ( ctx , left . answerId ) ;
133
127
134
- return SelectedOptions ;
128
+ if ( condition === "OneOf" ) {
129
+ if (
130
+ leftSideAnswer &&
131
+ leftSideAnswer . type === "MutuallyExclusive" &&
132
+ leftSideAnswer . options . length === 1
133
+ ) {
134
+ const SelectedOptions = {
135
+ [ routingConditionConversion ( "AllOf" ) ] : optionValues ,
136
+ } ;
137
+
138
+ return SelectedOptions ;
139
+ } else {
140
+ const swapOptionValues = ( [ optionValues [ 0 ] , optionValues [ 1 ] ] = [
141
+ optionValues [ 1 ] ,
142
+ optionValues [ 0 ] ,
143
+ ] ) ;
144
+ const SelectedOptions = {
145
+ [ routingConditionConversion ( condition ) ] : swapOptionValues ,
146
+ } ;
147
+
148
+ return SelectedOptions ;
149
+ }
135
150
}
136
151
137
152
const SelectedOptions = {
0 commit comments