Skip to content

Commit

Permalink
Fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Dec 13, 2023
1 parent 1c48c44 commit 71a0f29
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
18 changes: 12 additions & 6 deletions packages/desktop-client/src/components/reports/ReportOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,21 @@ 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
uncategorized_id. We also need a way to filter the
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 = {
Expand Down Expand Up @@ -105,7 +108,10 @@ const offBudgetCategory: UncategorizedEntity = {
has_category: true,
};

type UncategorizedGroupEntity = CategoryGroupEntity & {
type UncategorizedGroupEntity = Pick<
CategoryGroupEntity,
'name' | 'id' | 'hidden'
> & {
categories?: UncategorizedEntity[];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -99,8 +99,6 @@ function createGroupedSpreadsheet({
)
.reduce((a, v) => (a = a + v.amount), 0);
groupedDebts += monthDebts;

return null;
});

totalAssets += groupedAssets;
Expand Down

0 comments on commit 71a0f29

Please sign in to comment.