Skip to content

Conversation

Ahtaxam
Copy link
Owner

@Ahtaxam Ahtaxam commented Sep 7, 2022

No description provided.


// close the stream
writeStream.end();
const name = "report.csv";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

report name should include survey title too.


const surveyResponses = async (req, res) => {
try {
const surveys = await JoinSurvey.find({ surveyId: req.params.id });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name it Responses instead of JoinSurveys.

let path = __dirname;
path = path.replace("controller", "");
path = path + "assets/report.csv";
const writeStream = fs.createWriteStream(path);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use csv stringify package for csv generation.

writeStream.write("\n");
}

writeStream.on("finish", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use csv-stringify for csv report generation.

const Survey = require("../models/survey");
const Responses = require("../models/responses");
const fs = require("fs");
const { stringify } = require("csv-stringify");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line if the package is not included in the project.

@vercel
Copy link

vercel bot commented Sep 9, 2022

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

Name Status Preview Updated
nexresearch ✅ Ready (Inspect) Visit Preview Sep 12, 2022 at 0:34AM (UTC)
surveyapp ✅ Ready (Inspect) Visit Preview Sep 12, 2022 at 0:34AM (UTC)

@vercel
Copy link

vercel bot commented Sep 11, 2022

Deployment failed with the following error:

`routes[0]` should NOT have additional property `source`

@vercel
Copy link

vercel bot commented Sep 11, 2022

Deployment failed with the following error:

Rewrite at index 0 has invalid `source` pattern "/.*".

Learn More: https://vercel.link/invalid-route-source-pattern

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.

2 participants