mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 18:24:26 +08:00
remove redundant code
This commit is contained in:
@@ -245,26 +245,6 @@ export function selectAccountOrSubAccounts(filterAccountIds: Record<string, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectAllVisible(filterAccountIds: Record<string, boolean>, allAccountsMap: Record<string, Account>): 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<string, boolean>, allAccountsMap: Record<string, Account>): void {
|
export function selectAll(filterAccountIds: Record<string, boolean>, allAccountsMap: Record<string, Account>): void {
|
||||||
for (const accountId of keys(filterAccountIds)) {
|
for (const accountId of keys(filterAccountIds)) {
|
||||||
const account = allAccountsMap[accountId];
|
const account = allAccountsMap[accountId];
|
||||||
|
|||||||
+1
-19
@@ -132,7 +132,7 @@ export function getTransactionSecondaryCategoryName(categoryId: string | null |
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function filterTransactionCategories(allTransactionCategories: Record<number, TransactionCategory[]>, allowCategoryTypes?: Record<number, boolean>, allowCategoryName?: string, showHidden?: boolean): Record<number, TransactionCategory[]> {
|
export function filterTransactionCategories(allTransactionCategories: Record<number, TransactionCategory[]>, allowCategoryTypes?: Record<number, boolean>, allowCategoryName?: string, showHidden?: boolean): Record<string, TransactionCategory[]> {
|
||||||
const ret: Record<string, TransactionCategory[]> = {};
|
const ret: Record<string, TransactionCategory[]> = {};
|
||||||
const hasAllowCategoryTypes = allowCategoryTypes
|
const hasAllowCategoryTypes = allowCategoryTypes
|
||||||
&& (allowCategoryTypes[CategoryType.Income]
|
&& (allowCategoryTypes[CategoryType.Income]
|
||||||
@@ -374,24 +374,6 @@ export function selectAllSubCategories(filterCategoryIds: Record<string, boolean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectAllVisible(filterCategoryIds: Record<string, boolean>, allTransactionCategoriesMap: Record<string, TransactionCategory>): 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<string, boolean>, allTransactionCategoriesMap: Record<string, TransactionCategory>): void {
|
export function selectAll(filterCategoryIds: Record<string, boolean>, allTransactionCategoriesMap: Record<string, TransactionCategory>): void {
|
||||||
for (const categoryId of keys(filterCategoryIds)) {
|
for (const categoryId of keys(filterCategoryIds)) {
|
||||||
const category = allTransactionCategoriesMap[categoryId];
|
const category = allTransactionCategoriesMap[categoryId];
|
||||||
|
|||||||
@@ -478,16 +478,6 @@ export function selectInvert(filterItemIds: Record<string, boolean>, allItemsMap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectAllVisible(filterItemIds: Record<string, boolean>, 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<string, Record<string, unknown>[]>, primarySubItemsField: string, secondaryValueField: string | undefined, secondaryHiddenField: string | undefined, secondaryValue: unknown): boolean {
|
export function isPrimaryItemHasSecondaryValue(primaryItem: Record<string, Record<string, unknown>[]>, primarySubItemsField: string, secondaryValueField: string | undefined, secondaryHiddenField: string | undefined, secondaryValue: unknown): boolean {
|
||||||
const secondaryItems = primaryItem[primarySubItemsField];
|
const secondaryItems = primaryItem[primarySubItemsField];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user