From 861e4c036b323303938889737421d500e96b0cc5 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 14 Dec 2025 17:47:35 +0800 Subject: [PATCH] remove redundant code --- src/lib/account.ts | 20 -------------------- src/lib/category.ts | 20 +------------------- src/lib/common.ts | 10 ---------- 3 files changed, 1 insertion(+), 49 deletions(-) diff --git a/src/lib/account.ts b/src/lib/account.ts index 43f7cf7e..4f33c327 100644 --- a/src/lib/account.ts +++ b/src/lib/account.ts @@ -245,26 +245,6 @@ export function selectAccountOrSubAccounts(filterAccountIds: Record, allAccountsMap: Record): void { - for (const accountId of keys(filterAccountIds)) { - const account = allAccountsMap[accountId]; - - if (account) { - if (account.hidden) { - continue; - } - - if (account.parentId && allAccountsMap[account.parentId] && allAccountsMap[account.parentId]!.hidden) { - continue; - } - - if (account.type === AccountType.SingleAccount.type) { - filterAccountIds[account.id] = false; - } - } - } -} - export function selectAll(filterAccountIds: Record, allAccountsMap: Record): void { for (const accountId of keys(filterAccountIds)) { const account = allAccountsMap[accountId]; diff --git a/src/lib/category.ts b/src/lib/category.ts index 22a376d9..a5af2ee9 100644 --- a/src/lib/category.ts +++ b/src/lib/category.ts @@ -132,7 +132,7 @@ export function getTransactionSecondaryCategoryName(categoryId: string | null | return ''; } -export function filterTransactionCategories(allTransactionCategories: Record, allowCategoryTypes?: Record, allowCategoryName?: string, showHidden?: boolean): Record { +export function filterTransactionCategories(allTransactionCategories: Record, allowCategoryTypes?: Record, allowCategoryName?: string, showHidden?: boolean): Record { const ret: Record = {}; const hasAllowCategoryTypes = allowCategoryTypes && (allowCategoryTypes[CategoryType.Income] @@ -374,24 +374,6 @@ export function selectAllSubCategories(filterCategoryIds: Record, allTransactionCategoriesMap: Record): void { - for (const categoryId of keys(filterCategoryIds)) { - const category = allTransactionCategoriesMap[categoryId]; - - if (category) { - if (category.hidden) { - continue; - } - - if (category.parentId && allTransactionCategoriesMap[category.parentId] && allTransactionCategoriesMap[category.parentId]!.hidden) { - continue; - } - - filterCategoryIds[category.id] = false; - } - } -} - export function selectAll(filterCategoryIds: Record, allTransactionCategoriesMap: Record): void { for (const categoryId of keys(filterCategoryIds)) { const category = allTransactionCategoriesMap[categoryId]; diff --git a/src/lib/common.ts b/src/lib/common.ts index 3b221d8b..297746f2 100644 --- a/src/lib/common.ts +++ b/src/lib/common.ts @@ -478,16 +478,6 @@ export function selectInvert(filterItemIds: Record, allItemsMap } } -export function selectAllVisible(filterItemIds: Record, allItemsMap: { [key: string]: { id: string, hidden?: boolean } }): void { - for (const itemId of keys(filterItemIds)) { - const item = allItemsMap[itemId]; - - if (item && !item.hidden) { - filterItemIds[item.id] = false; - } - } -} - export function isPrimaryItemHasSecondaryValue(primaryItem: Record[]>, primarySubItemsField: string, secondaryValueField: string | undefined, secondaryHiddenField: string | undefined, secondaryValue: unknown): boolean { const secondaryItems = primaryItem[primarySubItemsField];