Skip to content
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

Merged
merged 7 commits into from
Jan 29, 2024
Merged

chore: Tags and notes to csv exports #1968

merged 7 commits into from
Jan 29, 2024

Conversation

Dhruwang
Copy link
Contributor

@Dhruwang Dhruwang commented Jan 26, 2024

What does this PR do?

Fixes # 1785
Screenshot 2024-01-26 at 3 42 11 PM
Screenshot 2024-01-26 at 3 40 47 PM

How should this be tested?

Download CSV

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • First PR at Formbricks? Please sign the CLA! Without it we wont be able to merge it 🙏

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

Copy link

vercel bot commented Jan 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
formbricks-cloud ⬜️ Ignored (Inspect) Visit Preview Jan 29, 2024 2:28pm
formbricks-com ⬜️ Ignored (Inspect) Visit Preview Jan 29, 2024 2:28pm

Copy link
Contributor

github-actions bot commented Jan 26, 2024

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

apps/web/app/(app)/environments/[environmentId]/surveys/[surveyId]/components/CustomFilter.tsx

Consider breaking down the getMatchQandA function into smaller functions, each with a single responsibility. This would make the code easier to read and maintain.
Create Issue
See the diff
Checkout the fix

    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 [];
    };
git fetch origin && git checkout -b ReviewBot/The-f-heqxj4o origin/ReviewBot/The-f-heqxj4o

Consider breaking down the downloadResponses function into smaller functions, each with a single responsibility. This would make the code easier to read and maintain.
Create Issue
See the diff
Checkout the fix

    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]
    );
git fetch origin && git checkout -b ReviewBot/The-`-my93z5q origin/ReviewBot/The-`-my93z5q

@jobenjada jobenjada self-assigned this Jan 26, 2024
@jobenjada
Copy link
Member

jobenjada commented Jan 26, 2024

hey Dhru! Looks great, thanks :) Now that we're at this, please:

  1. Remove the Formbricks User Id from all exports
  2. Add userId fill it when the data is available

Thanks!

@jobenjada jobenjada added this pull request to the merge queue Jan 29, 2024
Merged via the queue into main with commit fc2beb3 Jan 29, 2024
13 checks passed
@jobenjada jobenjada deleted the tags-in-csv branch January 29, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants