Browse Source

Bugfix/handling of Exclude from Analysis tag in activities table (#7511)

* Fix handling of Exclude from Analysis tag

* Update changelog
pull/7506/head^2
Thomas Kaul 7 days ago
committed by GitHub
parent
commit
fa309b5743
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 27
      libs/common/src/lib/helper.spec.ts
  3. 4
      libs/common/src/lib/helper.ts
  4. 2
      libs/ui/src/lib/activities-table/activities-table.component.ts

1
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

27
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);

4
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
);

2
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

Loading…
Cancel
Save