Fix acceleration dashboard merge issues

This commit is contained in:
Mononaut
2023-08-30 22:24:27 +09:00
parent b0e73466fa
commit f26b630aab
5 changed files with 17 additions and 10 deletions

View File

@@ -98,7 +98,7 @@ export class AccelerationFeesGraphComponent implements OnInit {
this.isLoading = true;
this.storageService.setValue('miningWindowPreference', timespan);
this.timespan = timespan;
return this.apiService.getAccelerations$();
return this.apiService.getAccelerationHistory$();
})
),
this.radioGroupForm.get('dateSpan').valueChanges.pipe(
@@ -128,11 +128,11 @@ export class AccelerationFeesGraphComponent implements OnInit {
const blockAccelerations = {};
for (const acceleration of accelerations) {
if (acceleration.mined) {
if (!blockAccelerations[acceleration.block_height]) {
blockAccelerations[acceleration.block_height] = [];
if (acceleration.status === 'mined' || acceleration.status === 'completed') {
if (!blockAccelerations[acceleration.blockHeight]) {
blockAccelerations[acceleration.blockHeight] = [];
}
blockAccelerations[acceleration.block_height].push(acceleration);
blockAccelerations[acceleration.blockHeight].push(acceleration);
}
}

View File

@@ -28,6 +28,7 @@
{{ acceleration.feeDelta | number }} <span class="symbol" i18n="shared.sat|sat">sat</span>
</td>
<td class="status text-right">
<span *ngIf="acceleration.status === 'accelerating'" class="badge badge-warning" i18n="transaction.rbf.mined">Pending</span>
<span *ngIf="acceleration.status === 'mined' || acceleration.status === 'completed'" class="badge badge-success" i18n="transaction.rbf.mined">Mined</span>
<span *ngIf="acceleration.status === 'failed'" class="badge badge-danger" i18n="accelerator.canceled">Canceled</span>
</td>

View File

@@ -39,12 +39,12 @@ 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$().pipe(
this.accelerations$ = this.apiService.getAccelerationHistory$().pipe(
switchMap(accelerations => {
if (this.widget) {
return of(accelerations.slice(0, 6));
return of(accelerations.slice(-6).reverse());
} else {
return of(accelerations);
return of(accelerations.reverse());
}
}),
catchError((err) => {

View File

@@ -56,10 +56,10 @@ export class AcceleratorDashboardComponent implements OnInit {
switchMap(([blocks, accelerations]) => {
const accelerationsByBlock: { [ hash: string ]: Acceleration[] } = {};
for (const acceleration of accelerations) {
if (acceleration.mined && !accelerationsByBlock[acceleration.blockHash]) {
if (['mined', 'completed'].includes(acceleration.status) && !accelerationsByBlock[acceleration.blockHash]) {
accelerationsByBlock[acceleration.blockHash] = [];
}
if (acceleration.mined) {
if (['mined', 'completed'].includes(acceleration.status)) {
accelerationsByBlock[acceleration.blockHash].push(acceleration);
}
}