mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-12 03:09:41 -06:00
* feat: moves edit team name to server components * feat: server components for membership roles * feat: adds server actions and services * fix: fixes invite server action * feat: adds packages for jwt and email * feat: server actions * feat: moves edit memberships logic to server components * feat: moves delete team logic to server components * fix: fixes team loading states * rename getAllMembershipsByUserId -> getMembershipsByUserId * remove cache from mutating functions * remove cache from updateInvite * refactoring * fix build error --------- Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
21 lines
629 B
TypeScript
21 lines
629 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: typeof answer !== "undefined" ? answer.toString() : "",
|
|
});
|
|
}
|
|
|
|
return questionResponseMapping;
|
|
};
|