mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-03 12:19:50 -06:00
* add email notifications settings with notification options on finished responses --------- Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
21 lines
568 B
TypeScript
21 lines
568 B
TypeScript
import { Question } from "@formbricks/types/questions";
|
|
import { Response } from "@formbricks/types/responses";
|
|
|
|
export const getQuestionResponseMapping = (
|
|
survey: { questions: Question[] },
|
|
response: Response
|
|
): { question: string; answer: string }[] => {
|
|
const questionResponseMapping: { question: string; answer: string }[] = [];
|
|
|
|
for (const question of survey.questions) {
|
|
const answer = response.data[question.id];
|
|
|
|
questionResponseMapping.push({
|
|
question: question.headline,
|
|
answer,
|
|
});
|
|
}
|
|
|
|
return questionResponseMapping;
|
|
};
|