From 0d338bb0831db79b2c76dd2931e4d3845ec53f37 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 19 Nov 2022 12:13:02 +0100 Subject: [PATCH] Bugfix/fix dynamic decimal places for cryptocurrencies in position detail dialog (#1464) * Fix dynamic decimal places * Update changelog --- CHANGELOG.md | 1 + .../position-detail-dialog.component.ts | 11 +++++++++++ .../position-detail-dialog.html | 10 +++------- apps/client/src/app/services/data.service.ts | 14 -------------- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2473a31e..b6becf303 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed the activities sorting in the position detail dialog +- Fixed the dynamic number of decimal places for cryptocurrencies in the position detail dialog - Fixed a division by zero error in the cash positions calculation ## 1.213.0 - 14.11.2022 diff --git a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts index f8d3038b7..8d19b846e 100644 --- a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts +++ b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts @@ -14,6 +14,7 @@ import { LineChartItem } from '@ghostfolio/common/interfaces'; import { OrderWithAccount } from '@ghostfolio/common/types'; +import { translate } from '@ghostfolio/ui/i18n'; import { Tag } from '@prisma/client'; import { format, isSameMonth, isToday, parseISO } from 'date-fns'; import { Subject } from 'rxjs'; @@ -29,6 +30,8 @@ import { PositionDetailDialogParams } from './interfaces/interfaces'; styleUrls: ['./position-detail-dialog.component.scss'] }) export class PositionDetailDialog implements OnDestroy, OnInit { + public assetClass: string; + public assetSubClass: string; public averagePrice: number; public benchmarkDataItems: LineChartItem[]; public countries: { @@ -126,6 +129,14 @@ export class PositionDetailDialog implements OnDestroy, OnInit { this.transactionCount = transactionCount; this.value = value; + if (SymbolProfile?.assetClass) { + this.assetClass = translate(SymbolProfile?.assetClass); + } + + if (SymbolProfile?.assetSubClass) { + this.assetSubClass = translate(SymbolProfile?.assetSubClass); + } + if (SymbolProfile?.countries?.length > 0) { for (const country of SymbolProfile.countries) { this.countries[country.code] = { diff --git a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html index 52b0e1858..4004f077f 100644 --- a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html +++ b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.html @@ -139,11 +139,7 @@ >