Bugfix/fix values in position detail dialog (#351)

* Nullify netPerformance

* Introduce precision

* Update changelog
pull/352/head^2
Thomas Kaul 3 years ago committed by GitHub
parent ee5ab05d8a
commit 9cbf789c22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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/), 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
### Added
- Added the attribute `precision` in the value component
### Fixed
- Hid the performance in the _Presenter View_
## 1.47.1 - 06.09.2021 ## 1.47.1 - 06.09.2021
### Fixed ### Fixed

@ -276,6 +276,7 @@ export class PortfolioController {
position = nullifyValuesInObject(position, [ position = nullifyValuesInObject(position, [
'grossPerformance', 'grossPerformance',
'investment', 'investment',
'netPerformance',
'quantity' 'quantity'
]); ]);
} }

@ -80,7 +80,8 @@
<gf-value <gf-value
label="Quantity" label="Quantity"
size="medium" size="medium"
[isCurrency]="true" [locale]="data.locale"
[precision]="2"
[value]="quantity" [value]="quantity"
></gf-value> ></gf-value>
</div> </div>
@ -103,8 +104,6 @@
<div class="col-6 mb-3"> <div class="col-6 mb-3">
<gf-value <gf-value
size="medium" size="medium"
[isCurrency]="false"
[isInteger]="true"
[label]="transactionCount === 1 ? 'Transaction' : 'Transactions'" [label]="transactionCount === 1 ? 'Transaction' : 'Transactions'"
[locale]="data.locale" [locale]="data.locale"
[value]="transactionCount" [value]="transactionCount"

@ -13,7 +13,7 @@
"error", "error",
{ {
"type": "attribute", "type": "attribute",
"prefix": "ghostfolio", "prefix": "gf",
"style": "camelCase" "style": "camelCase"
} }
], ],
@ -21,7 +21,7 @@
"error", "error",
{ {
"type": "element", "type": "element",
"prefix": "ghostfolio", "prefix": "gf",
"style": "kebab-case" "style": "kebab-case"
} }
] ]

@ -29,17 +29,16 @@ Currency.args = {
value: 7 value: 7
}; };
export const Integer = Template.bind({});
Integer.args = {
isInteger: true,
locale: 'en-US',
value: 7
};
export const Label = Template.bind({}); export const Label = Template.bind({});
Label.args = { Label.args = {
isInteger: true,
label: 'Label', label: 'Label',
locale: 'en-US', locale: 'en-US',
value: 7 value: 7.25
};
export const Precision = Template.bind({});
Precision.args = {
locale: 'en-US',
precision: 3,
value: 7.2534802394809285309
}; };

@ -18,11 +18,11 @@ export class ValueComponent implements OnChanges {
@Input() colorizeSign = false; @Input() colorizeSign = false;
@Input() currency = ''; @Input() currency = '';
@Input() isCurrency = false; @Input() isCurrency = false;
@Input() isInteger = false;
@Input() isPercent = false; @Input() isPercent = false;
@Input() label = ''; @Input() label = '';
@Input() locale = ''; @Input() locale = '';
@Input() position = ''; @Input() position = '';
@Input() precision: number | undefined;
@Input() size = ''; @Input() size = '';
@Input() value: number | string = ''; @Input() value: number | string = '';
@ -82,13 +82,15 @@ export class ValueComponent implements OnChanges {
minimumFractionDigits: 2 minimumFractionDigits: 2
}); });
} catch {} } catch {}
} else if (this.isInteger) { } else if (this.precision || this.precision === 0) {
try { try {
this.formattedValue = this.value?.toLocaleString(this.locale, { this.formattedValue = this.value?.toLocaleString(this.locale, {
maximumFractionDigits: 0, maximumFractionDigits: this.precision,
minimumFractionDigits: 0 minimumFractionDigits: this.precision
}); });
} catch {} } catch {}
} else {
this.formattedValue = this.value?.toString();
} }
} else { } else {
try { try {

Loading…
Cancel
Save