diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..b58b603f --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/climate-warehouse.iml b/.idea/climate-warehouse.iml new file mode 100644 index 00000000..0c8867d7 --- /dev/null +++ b/.idea/climate-warehouse.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..a55e7a17 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..2abc44e5 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/utils/xls.js b/src/utils/xls.js index 357cb7d7..cb6acedc 100644 --- a/src/utils/xls.js +++ b/src/utils/xls.js @@ -37,10 +37,18 @@ export const createXlsFromSequelizeResults = (rows, model) => { // Populate main sheet values for (const [mainColName, mainCol] of columnsInMainSheet.entries()) { if (!Object.keys(sheets).includes(model.name)) { - sheets[model.name] = { name: model.name + 's', data: [model.defaultColumns] }; // Column headings + sheets[model.name] = { + name: model.name + 's', + data: [ + columnsInMainSheet + ] + }; // Column headings } if (!associations.map(singular => singular + 's').includes(mainColName)) { + if (row[mainCol] === null) { + row[mainCol] = 'null'; + } mainXlsRow.push(row[mainCol]); } @@ -55,7 +63,7 @@ export const createXlsFromSequelizeResults = (rows, model) => { for (const associatedModel of associatedModels) { const xlsRow = []; // Column headings for associated sheets will be available for associated sheets once its referenced by a row - if (!Object.keys(sheets).includes(associatedModel) && row[associatedModel + 's'].length > 0) { + if (!Object.keys(sheets).includes(associatedModel) && row[associatedModel].length > 0) { sheets[associatedModel] = { name: associatedModel, data: [