Browse Source

Task/improve dynamic numerical precision in account and holding detail dialogs on mobile (#7022)

* Improve dynamic numerical precision for various values

* Update changelog
pull/7023/head^2
Thomas Kaul 1 week ago
committed by GitHub
parent
commit
5743825bc6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      CHANGELOG.md
  2. 10
      apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts
  3. 17
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

5
CHANGELOG.md

@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
### Changed
- Improved the dynamic numerical precision for various values in the account detail dialog on mobile
- Improved the dynamic numerical precision for various values in the holding detail dialog on mobile
### Fixed ### Fixed
- Fixed an issue in the import dividends dialog - Fixed an issue in the import dividends dialog

10
apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts

@ -3,7 +3,7 @@ import { UserService } from '@ghostfolio/client/services/user/user.service';
import { import {
DEFAULT_DATE_RANGE, DEFAULT_DATE_RANGE,
DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE,
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
} from '@ghostfolio/common/config'; } from '@ghostfolio/common/config';
import { CreateAccountBalanceDto } from '@ghostfolio/common/dtos'; import { CreateAccountBalanceDto } from '@ghostfolio/common/dtos';
import { DATE_FORMAT, downloadAsFile } from '@ghostfolio/common/helper'; import { DATE_FORMAT, downloadAsFile } from '@ghostfolio/common/helper';
@ -245,7 +245,7 @@ export class GfAccountDetailDialogComponent implements OnInit {
this.balance = balance; this.balance = balance;
if ( if (
this.balance >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES && this.balance >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES &&
this.data.deviceType === 'mobile' this.data.deviceType === 'mobile'
) { ) {
this.balancePrecision = 0; this.balancePrecision = 0;
@ -257,7 +257,7 @@ export class GfAccountDetailDialogComponent implements OnInit {
if ( if (
this.data.deviceType === 'mobile' && this.data.deviceType === 'mobile' &&
this.dividendInBaseCurrency >= this.dividendInBaseCurrency >=
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
) { ) {
this.dividendInBaseCurrencyPrecision = 0; this.dividendInBaseCurrencyPrecision = 0;
} }
@ -267,7 +267,7 @@ export class GfAccountDetailDialogComponent implements OnInit {
if ( if (
this.data.deviceType === 'mobile' && this.data.deviceType === 'mobile' &&
this.equity >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES this.equity >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
) { ) {
this.equityPrecision = 0; this.equityPrecision = 0;
} }
@ -280,7 +280,7 @@ export class GfAccountDetailDialogComponent implements OnInit {
if ( if (
this.data.deviceType === 'mobile' && this.data.deviceType === 'mobile' &&
this.interestInBaseCurrency >= this.interestInBaseCurrency >=
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
) { ) {
this.interestInBaseCurrencyPrecision = 0; this.interestInBaseCurrencyPrecision = 0;
} }

17
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

@ -2,8 +2,7 @@ import { UserService } from '@ghostfolio/client/services/user/user.service';
import { import {
DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE,
NUMERICAL_PRECISION_THRESHOLD_3_FIGURES, NUMERICAL_PRECISION_THRESHOLD_3_FIGURES,
NUMERICAL_PRECISION_THRESHOLD_5_FIGURES, NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES
} from '@ghostfolio/common/config'; } from '@ghostfolio/common/config';
import { CreateOrderDto } from '@ghostfolio/common/dtos'; import { CreateOrderDto } from '@ghostfolio/common/dtos';
import { import {
@ -282,7 +281,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
this.averagePrice = averagePrice; this.averagePrice = averagePrice;
if ( if (
this.averagePrice >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES && this.averagePrice >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES &&
this.data.deviceType === 'mobile' this.data.deviceType === 'mobile'
) { ) {
this.averagePricePrecision = 0; this.averagePricePrecision = 0;
@ -297,7 +296,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if ( if (
this.data.deviceType === 'mobile' && this.data.deviceType === 'mobile' &&
this.dividendInBaseCurrency >= this.dividendInBaseCurrency >=
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
) { ) {
this.dividendInBaseCurrencyPrecision = 0; this.dividendInBaseCurrencyPrecision = 0;
} }
@ -335,7 +334,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if ( if (
this.data.deviceType === 'mobile' && this.data.deviceType === 'mobile' &&
this.investmentInBaseCurrencyWithCurrencyEffect >= this.investmentInBaseCurrencyWithCurrencyEffect >=
NUMERICAL_PRECISION_THRESHOLD_6_FIGURES NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
) { ) {
this.investmentInBaseCurrencyWithCurrencyEffectPrecision = 0; this.investmentInBaseCurrencyWithCurrencyEffectPrecision = 0;
} }
@ -345,7 +344,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if ( if (
this.data.deviceType === 'mobile' && this.data.deviceType === 'mobile' &&
this.marketPriceMax >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES this.marketPriceMax >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
) { ) {
this.marketPriceMaxPrecision = 0; this.marketPriceMaxPrecision = 0;
} }
@ -354,14 +353,14 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if ( if (
this.data.deviceType === 'mobile' && this.data.deviceType === 'mobile' &&
this.marketPriceMin >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES this.marketPriceMin >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
) { ) {
this.marketPriceMinPrecision = 0; this.marketPriceMinPrecision = 0;
} }
if ( if (
this.data.deviceType === 'mobile' && this.data.deviceType === 'mobile' &&
this.marketPrice >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES this.marketPrice >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
) { ) {
this.marketPricePrecision = 0; this.marketPricePrecision = 0;
} }
@ -370,7 +369,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if ( if (
this.data.deviceType === 'mobile' && this.data.deviceType === 'mobile' &&
this.netPerformance >= NUMERICAL_PRECISION_THRESHOLD_6_FIGURES this.netPerformance >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
) { ) {
this.netPerformancePrecision = 0; this.netPerformancePrecision = 0;
} }

Loading…
Cancel
Save