From fa309b57435df39f0b1ad5a25c2b13c3145e2642 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 1 Aug 2026 23:16:24 +0200 Subject: [PATCH] Bugfix/handling of Exclude from Analysis tag in activities table (#7511) * Fix handling of Exclude from Analysis tag * Update changelog --- CHANGELOG.md | 1 + libs/common/src/lib/helper.spec.ts | 27 +++++++++++++++++++ libs/common/src/lib/helper.ts | 4 +-- .../activities-table.component.ts | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 054a24bdf..1118f2a69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed the handling of the _Exclude from Analysis_ tag in the activities table - Resolved a validation error caused by empty strings in the asset profile details dialog of the admin control panel ## 3.39.0 - 2026-08-01 diff --git a/libs/common/src/lib/helper.spec.ts b/libs/common/src/lib/helper.spec.ts index 758934724..c4947394f 100644 --- a/libs/common/src/lib/helper.spec.ts +++ b/libs/common/src/lib/helper.spec.ts @@ -1,8 +1,13 @@ +import { + TAG_ID_EMERGENCY_FUND, + TAG_ID_EXCLUDE_FROM_ANALYSIS +} from '@ghostfolio/common/config'; import { extractNumberFromString, getNumberFormatGroup, getStringOrNull, getStringOrUndefined, + isAccountExcluded, isCurrency, isCurrencySymbol } from '@ghostfolio/common/helper'; @@ -197,6 +202,28 @@ describe('Helper', () => { }); }); + describe('Is account excluded', () => { + it('Account with Exclude from Analysis tag', () => { + expect( + isAccountExcluded({ tags: [{ id: TAG_ID_EXCLUDE_FROM_ANALYSIS }] }) + ).toEqual(true); + }); + + it('Account with another tag', () => { + expect( + isAccountExcluded({ tags: [{ id: TAG_ID_EMERGENCY_FUND }] }) + ).toEqual(false); + }); + + it('Account without tags', () => { + expect(isAccountExcluded({ tags: [] })).toEqual(false); + }); + + it('Undefined account', () => { + expect(isAccountExcluded(undefined)).toEqual(false); + }); + }); + describe('Is currency', () => { it('ISO 4217 currency code', () => { expect(isCurrency('USD')).toEqual(true); diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts index 7e482838c..58927337e 100644 --- a/libs/common/src/lib/helper.ts +++ b/libs/common/src/lib/helper.ts @@ -476,9 +476,9 @@ export function interpolate(template: string, context: any) { }); } -export function isAccountExcluded(account: { tags?: { id: string }[] }) { +export function isAccountExcluded(account?: { tags?: { id: string }[] }) { return ( - account.tags?.some(({ id }) => { + account?.tags?.some(({ id }) => { return id === TAG_ID_EXCLUDE_FROM_ANALYSIS; }) === true ); diff --git a/libs/ui/src/lib/activities-table/activities-table.component.ts b/libs/ui/src/lib/activities-table/activities-table.component.ts index 6fac6d162..7252b0074 100644 --- a/libs/ui/src/lib/activities-table/activities-table.component.ts +++ b/libs/ui/src/lib/activities-table/activities-table.component.ts @@ -298,7 +298,7 @@ export class GfActivitiesTableComponent implements AfterViewInit, OnInit { public isExcludedFromAnalysis(activity: Activity) { return ( - (activity.account && isAccountExcluded(activity.account)) ?? + isAccountExcluded(activity.account) || activity.tags?.some(({ id }) => { return id === TAG_ID_EXCLUDE_FROM_ANALYSIS; }) === true