Files
formbricks-formbricks/apps/web/lib/responses/questionResponseMapping.ts
Johannes 4636ac9806 Add email notification settings (#295)
* add email notifications settings with notification options on finished responses

---------

Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
2023-05-24 17:07:05 +02:00

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;
};