From 71a0f29f27d7775ca47402a14f03edfb7b8bb42c Mon Sep 17 00:00:00 2001 From: Joel Jeremy Marquez Date: Wed, 13 Dec 2023 11:58:26 -0800 Subject: [PATCH] Fix type error --- .../src/components/reports/ReportOptions.tsx | 18 ++++++++++++------ .../spreadsheets/grouped-spreadsheet.ts | 4 +--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/desktop-client/src/components/reports/ReportOptions.tsx b/packages/desktop-client/src/components/reports/ReportOptions.tsx index 2642e634354..014d011c847 100644 --- a/packages/desktop-client/src/components/reports/ReportOptions.tsx +++ b/packages/desktop-client/src/components/reports/ReportOptions.tsx @@ -63,7 +63,10 @@ export type QueryDataEntity = { amount: number; }; -export type UncategorizedEntity = CategoryEntity & { +export type UncategorizedEntity = Pick< + CategoryEntity, + 'name' | 'id' | 'hidden' +> & { /* When looking at uncategorized and hidden transactions we need a way to group them. To do this we give them a unique @@ -71,10 +74,10 @@ export type UncategorizedEntity = CategoryEntity & { transctions from our query. For this we use the 3 variables below. */ - uncategorized_id: string; - is_off_budget: boolean; - is_transfer: boolean; - has_category: boolean; + uncategorized_id?: string; + is_off_budget?: boolean; + is_transfer?: boolean; + has_category?: boolean; }; const uncategorizedCategory: UncategorizedEntity = { @@ -105,7 +108,10 @@ const offBudgetCategory: UncategorizedEntity = { has_category: true, }; -type UncategorizedGroupEntity = CategoryGroupEntity & { +type UncategorizedGroupEntity = Pick< + CategoryGroupEntity, + 'name' | 'id' | 'hidden' +> & { categories?: UncategorizedEntity[]; }; diff --git a/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts b/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts index c0199b5a79c..e399c581048 100644 --- a/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts +++ b/packages/desktop-client/src/components/reports/spreadsheets/grouped-spreadsheet.ts @@ -85,7 +85,7 @@ function createGroupedSpreadsheet({ let groupedAssets = 0; let groupedDebts = 0; - group.categories.map(item => { + group.categories.forEach(item => { const monthAssets = filterHiddenItems(item, assets) .filter( asset => asset.date === month && asset.category === item.id, @@ -99,8 +99,6 @@ function createGroupedSpreadsheet({ ) .reduce((a, v) => (a = a + v.amount), 0); groupedDebts += monthDebts; - - return null; }); totalAssets += groupedAssets;