Commit a3e4cb72 authored by antoine masson's avatar antoine masson
Browse files

v1.09

fix bug when answers in empty in csv export
parent 7ba2cc36
......@@ -148,10 +148,15 @@ exports.downCSV_survey_tokens = async (req,res)=>{
let tokensjson=await JSON.parse(JSON.stringify(tokens))
tokensjson.forEach(o=>o.survey_id=survey.general.short_name)
tokensjson.forEach(o=>{delete o.test; delete o.id})
tokensjson.forEach(o=>{ //remove special characters in post and presurvey
if(o.answers.presurvey) Object.keys(o.answers.presurvey).forEach(function(el){o.answers.presurvey[el]=removeNonAsciiChars(o.answers.presurvey[el])});
if(o.answers.postsurvey) Object.keys(o.answers.postsurvey).forEach(function(el){o.answers.postsurvey[el]=removeNonAsciiChars(o.answers.postsurvey[el])});
if (o.answers) {
if(o.answers.presurvey) Object.keys(o.answers.presurvey).forEach(function(el){o.answers.presurvey[el]=removeNonAsciiChars(o.answers.presurvey[el])});
if(o.answers.postsurvey) Object.keys(o.answers.postsurvey).forEach(function(el){o.answers.postsurvey[el]=removeNonAsciiChars(o.answers.postsurvey[el])});
}
});
const transforms = [flatten({ paths: ['answers'] })];
const parser = new Parser({transforms});
......
{
"name": "api",
"version": "1.0.8",
"version": "1.0.9",
"description": "",
"main": "index.js",
"scripts": {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment