-
Notifications
You must be signed in to change notification settings - Fork 902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Tags and notes to csv exports #1968
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 🙏 |
apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.tsxConsider breaking down the const mapQuestionIdToHeadline = (survey: TSurvey) => {
const questionIdToHeadline = {};
survey.questions.forEach((question) => {
questionIdToHeadline[question.id] = question.headline;
});
return questionIdToHeadline;
};
const updateResponses = (responses: TResponse[], questionIdToHeadline: any) => {
// ... existing code to update responses ...
};
const getMatchQandA = (responses: TResponse[], survey: TSurvey) => {
if (survey && responses) {
const questionIdToHeadline = mapQuestionIdToHeadline(survey);
const updatedResponses = updateResponses(responses, questionIdToHeadline);
// ... existing code to return updatedResponsesWithTags ...
}
return [];
};
Consider breaking down the const prepareFileResponse = (response: any, metaDataFields: string[], hiddenFieldIds: string[], questionNames: string[]) => {
// ... existing code to prepare fileResponse ...
};
const downloadResponses = useCallback(
async (filter: FilterDownload, filetype: "csv" | "xlsx") => {
// ... existing code to prepare downloadResponse, questionNames, hiddenFieldIds, metaDataFields, userAttributes, matchQandA ...
const jsonData = matchQandA.map((response) => {
const fileResponse = prepareFileResponse(response, metaDataFields, hiddenFieldIds, questionNames);
// ... existing code to return fileResponse ...
});
// ... existing code to download file ...
},
[downloadFileName, responses, survey, extracMetadataKeys, getAllResponsesInBatches]
);
|
hey Dhru! Looks great, thanks :) Now that we're at this, please:
Thanks! |
What does this PR do?
Fixes # 1785
How should this be tested?
Download CSV
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated