Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Bugfix/fix values in position detail dialog (#351)
Thomas Kaul9cbf789c22fe
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 85bc85855e..4936a5b713 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,16 @@ 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/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## Unreleased++### Added++- Added the attribute `precision` in the value component++### Fixed++- Hid the performance in the _Presenter View_+## 1.47.1 - 06.09.2021### Fixeddiff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.tsindex 34e7d53766..e2cf736144 100644--- a/apps/api/src/app/portfolio/portfolio.controller.ts+++ b/apps/api/src/app/portfolio/portfolio.controller.ts@@ -276,6 +276,7 @@ export class PortfolioController {position = nullifyValuesInObject(position, ['grossPerformance','investment',+ 'netPerformance','quantity']);}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.htmlindex 1847676f49..939f0f4dc0 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@@ -80,7 +80,8 @@<gf-valuelabel="Quantity"size="medium"- [isCurrency]="true"+ [locale]="data.locale"+ [precision]="2"[value]="quantity"></gf-value></div>@@ -103,8 +104,6 @@<div class="col-6 mb-3"><gf-valuesize="medium"- [isCurrency]="false"- [isInteger]="true"[label]="transactionCount === 1 ? 'Transaction' : 'Transactions'"[locale]="data.locale"[value]="transactionCount"diff --git a/libs/ui/.eslintrc.json b/libs/ui/.eslintrc.jsonindex 7b1712f158..80487666a2 100644--- a/libs/ui/.eslintrc.json+++ b/libs/ui/.eslintrc.json@@ -13,7 +13,7 @@"error",{"type": "attribute",- "prefix": "ghostfolio",+ "prefix": "gf","style": "camelCase"}],@@ -21,7 +21,7 @@"error",{"type": "element",- "prefix": "ghostfolio",+ "prefix": "gf","style": "kebab-case"}]diff --git a/libs/ui/src/lib/value/value.component.stories.ts b/libs/ui/src/lib/value/value.component.stories.tsindex f11eb256ef..8cd585de91 100644--- a/libs/ui/src/lib/value/value.component.stories.ts+++ b/libs/ui/src/lib/value/value.component.stories.ts@@ -29,17 +29,16 @@ Currency.args = {value: 7};-export const Integer = Template.bind({});-Integer.args = {- isInteger: true,- locale: 'en-US',- value: 7-};-export const Label = Template.bind({});Label.args = {- isInteger: true,label: 'Label',locale: 'en-US',- value: 7+ value: 7.25+};++export const Precision = Template.bind({});+Precision.args = {+ locale: 'en-US',+ precision: 3,+ value: 7.2534802394809285309};diff --git a/libs/ui/src/lib/value/value.component.ts b/libs/ui/src/lib/value/value.component.tsindex 8693920037..fbe6c2878a 100644--- a/libs/ui/src/lib/value/value.component.ts+++ b/libs/ui/src/lib/value/value.component.ts@@ -18,11 +18,11 @@ export class ValueComponent implements OnChanges {@Input() colorizeSign = false;@Input() currency = '';@Input() isCurrency = false;- @Input() isInteger = false;@Input() isPercent = false;@Input() label = '';@Input() locale = '';@Input() position = '';+ @Input() precision: number | undefined;@Input() size = '';@Input() value: number | string = '';@@ -82,13 +82,15 @@ export class ValueComponent implements OnChanges {minimumFractionDigits: 2});} catch {}- } else if (this.isInteger) {+ } else if (this.precision || this.precision === 0) {try {this.formattedValue = this.value?.toLocaleString(this.locale, {- maximumFractionDigits: 0,- minimumFractionDigits: 0+ maximumFractionDigits: this.precision,+ minimumFractionDigits: this.precision});} catch {}+ } else {+ this.formattedValue = this.value?.toString();}} else {try {