From f409c6712531831f257e156aba0ed18447c042fe Mon Sep 17 00:00:00 2001 From: Mononaut Date: Sat, 22 Jul 2023 15:30:48 +0900 Subject: [PATCH] update acceleration dashboard to match actual API format --- .../acceleration-stats/acceleration-stats.component.ts | 6 +++--- .../accelerations-list/accelerations-list.component.html | 6 +++--- .../accelerations-list/accelerations-list.component.ts | 2 +- .../accelerator-dashboard.component.ts | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/components/acceleration-stats/acceleration-stats.component.ts b/frontend/src/app/components/acceleration-stats/acceleration-stats.component.ts index 8c83c9d9c..ab423a216 100644 --- a/frontend/src/app/components/acceleration-stats/acceleration-stats.component.ts +++ b/frontend/src/app/components/acceleration-stats/acceleration-stats.component.ts @@ -18,16 +18,16 @@ export class AccelerationStatsComponent implements OnInit { ) { } ngOnInit(): void { - this.accelerationStats$ = this.apiService.getAccelerations$(this.timespan).pipe( + this.accelerationStats$ = this.apiService.getAccelerationHistory$(this.timespan).pipe( switchMap(accelerations => { let totalFeeDelta = 0; let totalMined = 0; let totalCanceled = 0; for (const acceleration of accelerations) { - if (acceleration.mined) { + if (acceleration.status === 'completed' || acceleration.status === 'mined') { totalMined++; totalFeeDelta += acceleration.feeDelta; - } else if (acceleration.canceled) { + } else if (acceleration.status === 'failed') { totalCanceled++; } } diff --git a/frontend/src/app/components/accelerations-list/accelerations-list.component.html b/frontend/src/app/components/accelerations-list/accelerations-list.component.html index 367b6f33d..4b37f28c0 100644 --- a/frontend/src/app/components/accelerations-list/accelerations-list.component.html +++ b/frontend/src/app/components/accelerations-list/accelerations-list.component.html @@ -22,14 +22,14 @@ - {{ acceleration.fee | number }} sat + {{ acceleration.feePaid | number }} sat {{ acceleration.feeDelta | number }} sat - Mined - Canceled + Mined + Canceled diff --git a/frontend/src/app/components/accelerations-list/accelerations-list.component.ts b/frontend/src/app/components/accelerations-list/accelerations-list.component.ts index 0b1cdd3ba..70dbd03f0 100644 --- a/frontend/src/app/components/accelerations-list/accelerations-list.component.ts +++ b/frontend/src/app/components/accelerations-list/accelerations-list.component.ts @@ -39,7 +39,7 @@ export class AccelerationsListComponent implements OnInit { this.skeletonLines = this.widget === true ? [...Array(6).keys()] : [...Array(15).keys()]; this.paginationMaxSize = window.matchMedia('(max-width: 670px)').matches ? 3 : 5; - this.accelerations$ = this.apiService.getAccelerations$('24h').pipe( + this.accelerations$ = this.apiService.getAccelerations$().pipe( switchMap(accelerations => { if (this.widget) { return of(accelerations.slice(0, 6)); diff --git a/frontend/src/app/components/accelerator-dashboard/accelerator-dashboard.component.ts b/frontend/src/app/components/accelerator-dashboard/accelerator-dashboard.component.ts index 499984d2e..aaf7be825 100644 --- a/frontend/src/app/components/accelerator-dashboard/accelerator-dashboard.component.ts +++ b/frontend/src/app/components/accelerator-dashboard/accelerator-dashboard.component.ts @@ -46,7 +46,7 @@ export class AcceleratorDashboardComponent implements OnInit { return of(blocks as AccelerationBlock[]); }) ), - this.apiService.getAccelerations$('24h').pipe( + this.apiService.getAccelerationHistory$('24h').pipe( catchError((err) => { this.loadingBlocks = false; return of([]); @@ -56,11 +56,11 @@ export class AcceleratorDashboardComponent implements OnInit { switchMap(([blocks, accelerations]) => { const accelerationsByBlock: { [ hash: string ]: Acceleration[] } = {}; for (const acceleration of accelerations) { - if (acceleration.mined && !accelerationsByBlock[acceleration.block_hash]) { - accelerationsByBlock[acceleration.block_hash] = []; + if (acceleration.mined && !accelerationsByBlock[acceleration.blockHash]) { + accelerationsByBlock[acceleration.blockHash] = []; } if (acceleration.mined) { - accelerationsByBlock[acceleration.block_hash].push(acceleration); + accelerationsByBlock[acceleration.blockHash].push(acceleration); } } return of(blocks.slice(0, 6).map(block => {