Skip to content

Commit

Permalink
feat: xls export for units
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeen committed Jan 23, 2022
1 parent 069fb0d commit e386a13
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/utils/xls.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ export const createXlsFromSequelizeResults = (rows, model, hex = false, csv = fa
columnsInResults = Object.keys(rows[0]);
}

let associations = model.getAssociatedModels();
let associations = model.getAssociatedModels().map(model => {
if (typeof model === 'object') {
return model.model;
} else {
return model;
}
});
const columnsInMainSheet = columnsInResults.filter(col => !associations.map(a => a.name + 's').includes(col));
const associatedModels = columnsInResults.filter(col => associations.map(a => a.name + 's').includes(col));

Expand Down

0 comments on commit e386a13

Please sign in to comment.