Renaming variables for reports files (#2069)

* work

* notes

* error fixes

* updates

* card fix

* fix filters

* splitting PR work

* notes

* fixes

* lint fix

* Update upcoming-release-notes/2069.md

Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv>

---------

Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv>
This commit is contained in:
Neil
2023-12-12 13:06:05 +00:00
committed by GitHub
parent 36914abcd4
commit 8a721bf2e0
12 changed files with 164 additions and 148 deletions

View File

@@ -11,20 +11,24 @@ import makeQuery from './makeQuery';
import recalculate from './recalculate';
function createGroupedSpreadsheet({
start,
end,
startDate,
endDate,
categories,
selectedCategories,
conditions = [],
conditionsOp,
empty,
hidden,
uncat,
showEmpty,
showOffBudgetHidden,
showUncategorized,
balanceTypeOp,
}: createSpreadsheetProps) {
const [catList, catGroup] = categoryLists(hidden, uncat, categories);
const [categoryList, categoryGroup] = categoryLists(
showOffBudgetHidden,
showUncategorized,
categories,
);
const categoryFilter = (catList || []).filter(
const categoryFilter = (categoryList || []).filter(
category =>
!category.hidden &&
selectedCategories &&
@@ -34,7 +38,7 @@ function createGroupedSpreadsheet({
);
return async (spreadsheet, setData) => {
if (catList.length === 0) {
if (categoryList.length === 0) {
return null;
}
@@ -47,9 +51,9 @@ function createGroupedSpreadsheet({
runQuery(
makeQuery(
'assets',
start,
end,
hidden,
startDate,
endDate,
showOffBudgetHidden,
selectedCategories,
categoryFilter,
conditionsOpKey,
@@ -59,9 +63,9 @@ function createGroupedSpreadsheet({
runQuery(
makeQuery(
'debts',
start,
end,
hidden,
startDate,
endDate,
showOffBudgetHidden,
selectedCategories,
categoryFilter,
conditionsOpKey,
@@ -70,9 +74,9 @@ function createGroupedSpreadsheet({
).then(({ data }) => data),
]);
const months = monthUtils.rangeInclusive(start, end);
const months = monthUtils.rangeInclusive(startDate, endDate);
const groupedData = catGroup.map(
const groupedData = categoryGroup.map(
group => {
let totalAssets = 0;
let totalDebts = 0;
@@ -133,10 +137,11 @@ function createGroupedSpreadsheet({
categories: stackedCategories,
};
},
[start, end],
[startDate, endDate],
);
setData(
groupedData.filter(i => (!showEmpty ? i[balanceTypeOp] !== 0 : true)),
);
setData(groupedData.filter(i => (!empty ? i[balanceTypeOp] !== 0 : true)));
};
}