From 80fc3df76dc1f15f710fdf329ef459dd34c364da Mon Sep 17 00:00:00 2001 From: softsimon Date: Wed, 19 Aug 2020 11:33:18 +0700 Subject: [PATCH] bugfix: vbytespersecond display was limited to 1667 --- .../src/app/components/footer/footer.component.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/components/footer/footer.component.ts b/frontend/src/app/components/footer/footer.component.ts index 8b830efc4..adfeece6a 100644 --- a/frontend/src/app/components/footer/footer.component.ts +++ b/frontend/src/app/components/footer/footer.component.ts @@ -25,6 +25,7 @@ interface MempoolInfoData { export class FooterComponent implements OnInit { mempoolBlocksData$: Observable; mempoolInfoData$: Observable; + vBytesPerSecondLimit = 1667; constructor( private stateService: StateService, @@ -37,13 +38,7 @@ export class FooterComponent implements OnInit { ]) .pipe( map(([mempoolInfo, vbytesPerSecond]) => { - const vBytesPerSecondLimit = 1667; - let vBytesPerSecond = vbytesPerSecond; - if (vBytesPerSecond > 1667) { - vBytesPerSecond = 1667; - } - - const percent = Math.round((vBytesPerSecond / vBytesPerSecondLimit) * 100); + const percent = Math.round((Math.min(vbytesPerSecond, this.vBytesPerSecondLimit) / this.vBytesPerSecondLimit) * 100); let progressClass = 'bg-danger'; if (percent <= 75) { @@ -54,7 +49,7 @@ export class FooterComponent implements OnInit { return { memPoolInfo: mempoolInfo, - vBytesPerSecond: vBytesPerSecond, + vBytesPerSecond: vbytesPerSecond, progressWidth: percent + '%', progressClass: progressClass, };