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/),
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
### Fixed

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

@ -80,7 +80,8 @@
<gf-value
label="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-value
size="medium"
[isCurrency]="false"
[isInteger]="true"
[label]="transactionCount === 1 ? 'Transaction' : 'Transactions'"
[locale]="data.locale"
[value]="transactionCount"

@ -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"
}
]

@ -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
};

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

Loading…
Cancel
Save