From fcf09c6779746793bd28ec865224f7a0bb2966d7 Mon Sep 17 00:00:00 2001 From: catarak Date: Wed, 14 Sep 2016 16:30:50 -0400 Subject: [PATCH] even more db reformat --- server/utils/db_reformat.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server/utils/db_reformat.js b/server/utils/db_reformat.js index 2aa8a19a..03d2d4a8 100644 --- a/server/utils/db_reformat.js +++ b/server/utils/db_reformat.js @@ -87,6 +87,11 @@ Project.find({}) .exec((err, projects) => { projects.forEach((project, projectIndex) => { project.files.forEach((file) => { + if (file.isSelected && !file.isSelectedFile) { + file.isSelectedFile = file.isSelected; + delete file.isSelected; + } + if (file.name === 'sketch.js') { file.isSelectedFile = true; delete file.isSelected; @@ -105,9 +110,9 @@ Project.find({}) // if (file.isSelctedFile) { // console.log('changed to isSelected file'); // } - }); - project.save((err, savedProject) => { - console.log('project', projectIndex, 'is saved.'); + project.save((err, savedProject) => { + console.log('project', projectIndex, 'is saved.'); + }); }); }); });