Browse Source

Task/improve dynamic numerical precision for various values in account and holding detail dialogs on mobile (#7113)

* Improve dynamic numerical precision

* Update changelog
pull/7114/head^2
Thomas Kaul 5 days ago
committed by GitHub
parent
commit
608f9673b4
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. 16
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts
  4. 1
      libs/common/src/lib/config.ts

5
CHANGELOG.md

@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## 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 the disabled state of the delete action in the asset profiles actions menu of the historical market data table in the admin control panel

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

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

@ -2,7 +2,7 @@ import { UserService } from '@ghostfolio/client/services/user/user.service';
import {
DEFAULT_PAGE_SIZE,
NUMERICAL_PRECISION_THRESHOLD_3_FIGURES,
NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
NUMERICAL_PRECISION_THRESHOLD_4_FIGURES
} from '@ghostfolio/common/config';
import { CreateOrderDto } from '@ghostfolio/common/dtos';
import {
@ -288,7 +288,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
this.averagePrice = averagePrice;
if (
this.averagePrice >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES &&
this.averagePrice >= NUMERICAL_PRECISION_THRESHOLD_4_FIGURES &&
this.data.deviceType === 'mobile'
) {
this.averagePricePrecision = 0;
@ -307,7 +307,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if (
this.data.deviceType === 'mobile' &&
this.dividendInBaseCurrency >=
NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
NUMERICAL_PRECISION_THRESHOLD_4_FIGURES
) {
this.dividendInBaseCurrencyPrecision = 0;
}
@ -345,7 +345,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if (
this.data.deviceType === 'mobile' &&
this.investmentInBaseCurrencyWithCurrencyEffect >=
NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
NUMERICAL_PRECISION_THRESHOLD_4_FIGURES
) {
this.investmentInBaseCurrencyWithCurrencyEffectPrecision = 0;
}
@ -355,7 +355,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if (
this.data.deviceType === 'mobile' &&
this.marketPriceMax >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
this.marketPriceMax >= NUMERICAL_PRECISION_THRESHOLD_4_FIGURES
) {
this.marketPriceMaxPrecision = 0;
}
@ -364,14 +364,14 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if (
this.data.deviceType === 'mobile' &&
this.marketPriceMin >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
this.marketPriceMin >= NUMERICAL_PRECISION_THRESHOLD_4_FIGURES
) {
this.marketPriceMinPrecision = 0;
}
if (
this.data.deviceType === 'mobile' &&
this.marketPrice >= NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
this.marketPrice >= NUMERICAL_PRECISION_THRESHOLD_4_FIGURES
) {
this.marketPricePrecision = 0;
}
@ -393,7 +393,7 @@ export class GfHoldingDetailDialogComponent implements OnInit {
if (
this.data.deviceType === 'mobile' &&
this.netPerformanceWithCurrencyEffect >=
NUMERICAL_PRECISION_THRESHOLD_5_FIGURES
NUMERICAL_PRECISION_THRESHOLD_4_FIGURES
) {
this.netPerformanceWithCurrencyEffectPrecision = 0;
}

1
libs/common/src/lib/config.ts

@ -231,6 +231,7 @@ export const HEADER_KEY_SKIP_INTERCEPTOR = 'X-Skip-Interceptor';
export const MAX_TOP_HOLDINGS = 50;
export const NUMERICAL_PRECISION_THRESHOLD_3_FIGURES = 100;
export const NUMERICAL_PRECISION_THRESHOLD_4_FIGURES = 1000;
export const NUMERICAL_PRECISION_THRESHOLD_5_FIGURES = 10000;
export const NUMERICAL_PRECISION_THRESHOLD_6_FIGURES = 100000;

Loading…
Cancel
Save