Feature/prettify scraper symbol in chart (#448)

* Prettify scraper symbol in chart

* Update changelog
This commit is contained in:
Thomas Kaul 2021-11-01 20:29:16 +01:00 committed by GitHub
parent 9933967e42
commit 54bbc8446b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 7 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Prettified the generic scraper symbols in the portfolio proportion chart component
## 1.67.0 - 31.10.2021 ## 1.67.0 - 31.10.2021
### Added ### Added

View File

@ -4,6 +4,7 @@ import { DataService } from '@ghostfolio/client/services/data.service';
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
import { UNKNOWN_KEY } from '@ghostfolio/common/config'; import { UNKNOWN_KEY } from '@ghostfolio/common/config';
import { prettifySymbol } from '@ghostfolio/common/helper';
import { import {
PortfolioDetails, PortfolioDetails,
PortfolioPosition, PortfolioPosition,
@ -246,9 +247,9 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
} }
if (position.assetClass === AssetClass.EQUITY) { if (position.assetClass === AssetClass.EQUITY) {
this.symbols[symbol] = { this.symbols[prettifySymbol(symbol)] = {
symbol,
name: position.name, name: position.name,
symbol: prettifySymbol(symbol),
value: aPeriod === 'original' ? position.investment : position.value value: aPeriod === 'original' ? position.investment : position.value
}; };
} }

View File

@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { DataService } from '@ghostfolio/client/services/data.service'; import { DataService } from '@ghostfolio/client/services/data.service';
import { UNKNOWN_KEY } from '@ghostfolio/common/config'; import { UNKNOWN_KEY } from '@ghostfolio/common/config';
import { prettifySymbol } from '@ghostfolio/common/helper';
import { import {
PortfolioPosition, PortfolioPosition,
PortfolioPublicDetails PortfolioPublicDetails
@ -169,9 +170,9 @@ export class PublicPageComponent implements OnInit {
this.portfolioPublicDetails.holdings[symbol].value; this.portfolioPublicDetails.holdings[symbol].value;
} }
this.symbols[symbol] = { this.symbols[prettifySymbol(symbol)] = {
symbol,
name: position.name, name: position.name,
symbol: prettifySymbol(symbol),
value: position.value value: position.value
}; };
} }

View File

@ -1,11 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core';
import { ghostfolioScraperApiSymbolPrefix } from '@ghostfolio/common/config'; import { prettifySymbol } from '@ghostfolio/common/helper';
@Pipe({ name: 'gfSymbol' }) @Pipe({ name: 'gfSymbol' })
export class SymbolPipe implements PipeTransform { export class SymbolPipe implements PipeTransform {
public constructor() {} public constructor() {}
public transform(aSymbol: string): string { public transform(aSymbol: string) {
return aSymbol?.replace(ghostfolioScraperApiSymbolPrefix, ''); return prettifySymbol(aSymbol);
} }
} }

View File

@ -116,3 +116,7 @@ export const DATE_FORMAT = 'yyyy-MM-dd';
export function parseDate(date: string) { export function parseDate(date: string) {
return parse(date, DATE_FORMAT, new Date()); return parse(date, DATE_FORMAT, new Date());
} }
export function prettifySymbol(aSymbol: string): string {
return aSymbol?.replace(ghostfolioScraperApiSymbolPrefix, '');
}