Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/improve handling of Exclude from Analysis tag (#7533)

Thomas Kaul851901916b56
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7bd3340eca..1de1e82b92 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Extended the support of the _Exclude from Analysis_ tag from accounts to activities
- Optimized the performance of the search in the assistant by reusing the cached portfolio snapshot
### Fixed
diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts
index 5d60c571df..10e9c5240e 100644
--- a/apps/api/src/app/user/user.service.ts
+++ b/apps/api/src/app/user/user.service.ts
@@ -186,15 +186,15 @@ export class UserService {
systemMessage = systemMessageProperty;
}
- let tags = tagsForUser.filter((tag) => {
- return tag.id !== TAG_ID_EXCLUDE_FROM_ANALYSIS;
- });
+ let tags = tagsForUser;
if (
this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION') &&
subscription.type === SubscriptionType.Basic
) {
- tags = [];
+ tags = tags.filter(({ id }) => {
+ return id === TAG_ID_EXCLUDE_FROM_ANALYSIS;
+ });
}
return {
diff --git a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
index 2157ea5d34..86fc847112 100644
--- a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
+++ b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
@@ -1,5 +1,4 @@
import { UserService } from '@ghostfolio/client/services/user/user.service';
-import { TAG_ID_EXCLUDE_FROM_ANALYSIS } from '@ghostfolio/common/config';
import { CreateAccountDto, UpdateAccountDto } from '@ghostfolio/common/dtos';
import { getStringOrNull } from '@ghostfolio/common/helper';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
@@ -86,19 +85,13 @@ export class GfCreateOrUpdateAccountDialogComponent {
permissions.createOwnTag
);
- this.tagsAvailable = [
- ...(this.data.user?.tags ?? []),
- {
- id: TAG_ID_EXCLUDE_FROM_ANALYSIS,
- name: 'EXCLUDE_FROM_ANALYSIS',
- userId: null
- }
- ].map((tag) => {
- return {
- ...tag,
- name: translate(tag.name)
- };
- });
+ this.tagsAvailable =
+ this.data.user?.tags?.map((tag) => {
+ return {
+ ...tag,
+ name: translate(tag.name)
+ };
+ }) ?? [];
this.accountForm = this.formBuilder.group({
accountId: [{ disabled: true, value: this.data.account.id }],
diff --git a/libs/ui/src/lib/portfolio-filter-form/portfolio-filter-form.util.ts b/libs/ui/src/lib/portfolio-filter-form/portfolio-filter-form.util.ts
index ec3114d417..193624c768 100644
--- a/libs/ui/src/lib/portfolio-filter-form/portfolio-filter-form.util.ts
+++ b/libs/ui/src/lib/portfolio-filter-form/portfolio-filter-form.util.ts
@@ -1,3 +1,4 @@
+import { TAG_ID_EXCLUDE_FROM_ANALYSIS } from '@ghostfolio/common/config';
import { getAssetProfileIdentifier } from '@ghostfolio/common/helper';
import { Filter, PortfolioPosition } from '@ghostfolio/common/interfaces';
@@ -105,8 +106,8 @@ export function getTagFilters(
): Filter[] {
return (
tags
- ?.filter(({ isUsed }) => {
- return isUsed;
+ ?.filter(({ id, isUsed }) => {
+ return id !== TAG_ID_EXCLUDE_FROM_ANALYSIS && isUsed;
})
?.map(({ id, name }) => {
return {