Skip to content

Commit

Permalink
Change multiple and single choice questions to have has_open_choice f…
Browse files Browse the repository at this point in the history
…ield
  • Loading branch information
ssoonmi committed Nov 21, 2023
1 parent 7f40827 commit 49cdd52
Show file tree
Hide file tree
Showing 6 changed files with 379 additions and 143 deletions.
7 changes: 4 additions & 3 deletions frontend/src/scenes/surveys/SurveyAppearance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
BasicSurveyQuestion,
LinkSurveyQuestion,
} from '~/types'
import { defaultSurveyAppearance, QUESTION_CHOICE_OPEN_ENDED_PREFIX } from './constants'
import { defaultSurveyAppearance } from './constants'
import {
cancel,
check,
Expand Down Expand Up @@ -643,12 +643,13 @@ export function SurveyMultipleChoiceAppearance({
)}
<div className="multiple-choice-options">
{(multipleChoiceQuestion.choices || []).map((choice, idx) =>
choice.startsWith(QUESTION_CHOICE_OPEN_ENDED_PREFIX) ? (
multipleChoiceQuestion?.has_open_choice &&
idx === multipleChoiceQuestion.choices?.length - 1 ? (
<OpenEndedChoice
key={idx}
initialChecked={!!initialChecked?.includes(idx)}
inputType={inputType}
label={choice.slice(QUESTION_CHOICE_OPEN_ENDED_PREFIX.length)}
label={choice}
textColor={textColor}
/>
) : (
Expand Down
Loading

0 comments on commit 49cdd52

Please sign in to comment.