mirror of
https://github.com/formbricks/formbricks.git
synced 2026-03-17 23:56:49 -05:00
* Fix email notifications not working properly * Fix response notification not working * fix response meta schema * fix typo in docs * improve error message in webhooks
21 lines
592 B
TypeScript
21 lines
592 B
TypeScript
import { Question } from "@formbricks/types/questions";
|
|
import { TResponse } from "@formbricks/types/v1/responses";
|
|
|
|
export const getQuestionResponseMapping = (
|
|
survey: { questions: Question[] },
|
|
response: TResponse
|
|
): { 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: answer.toString(),
|
|
});
|
|
}
|
|
|
|
return questionResponseMapping;
|
|
};
|