Skip to content

Commit

Permalink
Merge pull request #74 from tom0827/EPICSYSTEM-64
Browse files Browse the repository at this point in the history
allow for sorting of simplesurvey questions
  • Loading branch information
tom0827 authored Jul 8, 2024
2 parents 993dbfb + 39c8e85 commit 557ee2b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,14 @@ export const ReportSettingsContextProvider = ({ children }: { children: JSX.Elem
const parseQuestions = (questions: Array<FormInfo>, questionOrder: Array<string>) => {
const numQuestions = questions?.length || 0;
for (let questionNum = 0; questionNum < numQuestions; questionNum++) {
questionOrder.push(questions.at(questionNum)?.id as string);
if (questions.at(questionNum)?.type === 'simplesurvey') {
const simpleSurveyOptions = questions.at(questionNum)?.questions as [{ value: string }];
simpleSurveyOptions.forEach((question) => {
questionOrder.push(`${questions.at(questionNum)?.id}-${question.value}`);
});
} else {
questionOrder.push(questions.at(questionNum)?.id as string);
}
}
};

Expand Down

0 comments on commit 557ee2b

Please sign in to comment.