Skip to content

Commit

Permalink
data bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
carkom committed Oct 28, 2023
1 parent a9e414d commit d367884
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,14 @@ export function TableTotals({
);
}

export function TotalTableList({ data, empty, monthsCount, typeItem, mode, split }) {
export function TotalTableList({
data,
empty,
monthsCount,
typeItem,
mode,
split,
}) {
const splitItem = ['Month', 'Year'].includes(split) ? 'date' : 'name';
const splitData =
split === 'Category'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,35 +209,33 @@ export default function createSpreadsheet(
}),
);

const gData =
[1].includes(split) &&
(await Promise.all(
categories.grouped.map(async group => {
const catData = await Promise.all(
group.categories.map(async graph => {
let catMatch = null;
graphData.map(async cat => {
if (cat.id === graph.id) {
catMatch = cat;
}
});
const calcCat = recalculate(catMatch, start, end);
return { ...calcCat };
}),
);
let groupMatch = null;
groupData.map(async split => {
if (split.id === group.id) {
groupMatch = split;
}
});
const calcGroup = recalculate(groupMatch, start, end);
return {
...calcGroup,
categories: catData,
};
}),
));
const gData = await Promise.all(
categories.grouped.map(async group => {
const catData = await Promise.all(
group.categories.map(async graph => {
let catMatch = null;
graphData.map(async cat => {
if (cat.id === graph.id) {
catMatch = cat;
}
});
const calcCat = catMatch && recalculate(catMatch, start, end);
return { ...calcCat };
}),
);
let groupMatch = null;
groupData.map(async split => {
if (split.id === group.id) {
groupMatch = split;
}
});
const calcGroup = groupMatch && recalculate(groupMatch, start, end);
return {
...calcGroup,
categories: catData,
};
}),
);

let totalAssets = 0;
let totalDebts = 0;
Expand Down

0 comments on commit d367884

Please sign in to comment.