Skip to content

Commit

Permalink
Fix init page and storing of default values
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed May 14, 2024
1 parent ee638be commit e483d7e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions rdmo/projects/assets/js/interview/utils/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ const initQuestionSet = (questionset) => {

// aggregate questionsets from decendants
questionset.questionsets = questionset.elements.reduce((questionsets, element) => {
return (element.model == 'questions.questionset') ? [...questionsets, element] : questionsets
if (element.model == 'questions.questionset') {
return questionsets.concat(element.questionsets)
} else {
return questionsets
}
}, [])

// aggregate optionsets from decendants
questionset.questions = questionset.elements.reduce((questions, element) => {
return (element.model == 'questions.question') ? [...questions, element] : questions
if (element.model == 'questions.questionset') {
return questions.concat(element.questions)
} else {
return [...questions, element]
}
}, [])

// aggregate optionsets from decendants
Expand Down

0 comments on commit e483d7e

Please sign in to comment.