Browse Source

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

* Improve handling of Exclude from Analysis tag

* Update changelog
pull/7467/head^2
Thomas Kaul 4 days ago
committed by GitHub
parent
commit
851901916b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 8
      apps/api/src/app/user/user.service.ts
  3. 13
      apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
  4. 5
      libs/ui/src/lib/portfolio-filter-form/portfolio-filter-form.util.ts

1
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

8
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 {

13
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) => {
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 }],

5
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 {

Loading…
Cancel
Save