Skip to content

Commit

Permalink
chore: fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Jan 24, 2022
2 parents 1796ba1 + 34a688c commit e6d3d53
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions src/utils/xls.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,37 @@ export const createXlsFromSequelizeResults = (
let mainXlsRow = [];

// Populate main sheet values
for (const [mainColName, mainCol] of columnsInMainSheet.entries()) {
for (const [i, mainColName] of columnsInMainSheet.entries()) {
if (row[mainColName] === null) {
row[mainColName] = 'null';
}

if (
!associations.map((singular) => singular + 's').includes(mainColName)
Object.keys(row).includes(mainColName) &&
Object.keys(row[mainColName]).includes('id')
) {
if (row[mainCol] === null) {
row[mainCol] = 'null';
if (!Object.keys(sheets).includes(mainColName + 's')) {
sheets[mainColName + 's'] = {
name: mainColName + 's',
data: [
Object.keys(row[mainColName]).concat([
model.name.split('_').join('') + 'Id',
]),
],
};
}
sheets[mainColName + 's'].data.push(
Object.values(row[mainColName])
.map((val1) => encodeValue(val1, hex))
.concat([encodeValue(row[mainColName].id, hex)]),
);
}
if (!associations.map((singular) => singular + 's').includes(i)) {
// Todo: change to colNames[i], but also filter column headings first (for skipping assoc cols)
if (row[mainColName] === null) {
row[mainColName] = 'null';
}
mainXlsRow.push(encodeValue(row[mainCol], hex));
mainXlsRow.push(encodeValue(row[mainColName], hex));
}
}

Expand Down

0 comments on commit e6d3d53

Please sign in to comment.