this time, db reformat, for real

This commit is contained in:
catarak 2016-09-14 16:41:36 -04:00
parent 03e2fd32c5
commit 7436f4960f
2 changed files with 26 additions and 30 deletions

View file

@ -462,7 +462,7 @@ IDEView.propTypes = {
function mapStateToProps(state) {
return {
files: state.files,
selectedFile: state.files.filter(file => file.isSelectedFile)[0],
selectedFile: state.files.find(file => file.isSelectedFile),
htmlFile: getHTMLFile(state.files),
jsFiles: getJSFiles(state.files),
cssFiles: getCSSFiles(state.files),

View file

@ -87,36 +87,32 @@ 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;
// console.log(file);
// // file.save((err, savedFile) => {
// // console.log('file saved');
// // });
// } else {
// file.isSelctedFile = false;
// }
// // console.log('project', projectIndex);
// // if (file.isSelected) {
// // console.log('is selected remains');
// // }
// // if (file.isSelctedFile) {
// // console.log('changed to isSelected file');
// // }
// project.save((err, savedProject) => {
// console.log('project', projectIndex, 'is saved.');
// });
if (file.fileType === 'folder' && file.isSelctedFile) {
console.log('there is an error');
if (file.isSelected) {
delete file.isSelected;
}
if (file.name === 'sketch.js') {
file.isSelectedFile = true;
delete file.isSelected;
console.log(file);
// file.save((err, savedFile) => {
// console.log('file saved');
// });
} else {
file.isSelectedFile = false;
}
// console.log('project', projectIndex);
// if (file.isSelected) {
// console.log('is selected remains');
// }
// if (file.isSelctedFile) {
// console.log('changed to isSelected file');
// }
project.save((err, savedProject) => {
console.log('project', projectIndex, 'is saved.');
});
});
});
});