From 39bf703b6cc6c85ac483c89b4271056c9c42751f Mon Sep 17 00:00:00 2001 From: Kostya Struga Date: Tue, 19 Jul 2022 16:59:29 +0300 Subject: [PATCH] Fix number --- .../analytics/components/base/base-analytics.component.html | 2 ++ .../components/base/services/base-analytics.service.ts | 4 ---- .../components/fb-info-card/fb-info-card.component.html | 5 ++++- .../shared/components/fb-info-card/fb-info-card.component.ts | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/app/sections/analytics/components/base/base-analytics.component.html b/src/app/sections/analytics/components/base/base-analytics.component.html index 2a7ac8b..357e786 100644 --- a/src/app/sections/analytics/components/base/base-analytics.component.html +++ b/src/app/sections/analytics/components/base/base-analytics.component.html @@ -29,6 +29,7 @@ [inProgress]="inProgress$" [units]="'%'" [type]="errorStyle" + [formatNumber]="true" >
diff --git a/src/app/sections/analytics/components/base/services/base-analytics.service.ts b/src/app/sections/analytics/components/base/services/base-analytics.service.ts index 35b8676..0561e22 100644 --- a/src/app/sections/analytics/components/base/services/base-analytics.service.ts +++ b/src/app/sections/analytics/components/base/services/base-analytics.service.ts @@ -35,22 +35,18 @@ export class BaseAnalyticsService { ); this.attemptedPayments$ = this.searchParameters$.pipe( switchMap((value) => this.analyticsService.getAttemptedPaymentsCount(value)), - filter((r) => !!r), shareReplay(1) ); this.blockedPayments$ = this.searchParameters$.pipe( switchMap((value) => this.analyticsService.getBlockedPaymentsCount(value)), - filter((r) => !!r), shareReplay(1) ); this.ratioOfBlocked$ = this.searchParameters$.pipe( switchMap((value) => this.analyticsService.getBlockedPaymentsRatio(value)), - filter((r) => !!r), shareReplay(1) ); this.blockedSum$ = this.searchParameters$.pipe( switchMap((value) => this.analyticsService.getBlockedPaymentsSum(value)), - filter((r) => !!r), shareReplay(1) ); this.chartDataX$ = this.searchParameters$.pipe( diff --git a/src/app/shared/components/fb-info-card/fb-info-card.component.html b/src/app/shared/components/fb-info-card/fb-info-card.component.html index 98fc3b3..b2c377e 100644 --- a/src/app/shared/components/fb-info-card/fb-info-card.component.html +++ b/src/app/shared/components/fb-info-card/fb-info-card.component.html @@ -4,7 +4,10 @@
-

+

+ {{ value | formatNumber }} {{ units }} +

+

{{ value | formatNumber | number: '.1-4' }} {{ units }}

diff --git a/src/app/shared/components/fb-info-card/fb-info-card.component.ts b/src/app/shared/components/fb-info-card/fb-info-card.component.ts index c4893ac..b69b699 100644 --- a/src/app/shared/components/fb-info-card/fb-info-card.component.ts +++ b/src/app/shared/components/fb-info-card/fb-info-card.component.ts @@ -12,6 +12,7 @@ export class FbInfoCardComponent { @Input() units = ''; @Input() type: string; @Input() inProgress: Observable; + @Input() formatNumber = false; numberFormat(num) { return num === 'NaN' || !num ? 0.0 : num;