+ {(q.options || []).map((o, optIdx) => (
+
+ {
+ if (q.question_type === 'multi') {
+ patchOpt(qIdx, optIdx, { is_correct: e.target.checked });
+ } else {
+ props.onChange(props.questions.map((qq, i) => {
+ if (i !== qIdx) return qq;
+ const opts = (qq.options || []).map((oo, j) => ({ ...oo, is_correct: j === optIdx }));
+ return { ...qq, options: opts };
+ }));
+ }
+ }}
+ />
+ patchOpt(qIdx, optIdx, { option_text: e.target.value })}
+ />
+ patchOpt(qIdx, optIdx, { explanation: e.target.value })}
+ />
+
+
+ ))}
+
+
+