Fix pool get blocks API undefined start block behavior
This commit is contained in:
parent
dfff57d204
commit
41fed984cb
@ -235,7 +235,7 @@ class BlocksRepository {
|
|||||||
/**
|
/**
|
||||||
* Get blocks mined by a specific mining pool
|
* Get blocks mined by a specific mining pool
|
||||||
*/
|
*/
|
||||||
public async $getBlocksByPool(poolId: number, startHeight: number | null = null): Promise<object[]> {
|
public async $getBlocksByPool(poolId: number, startHeight: number | undefined = undefined): Promise<object[]> {
|
||||||
const params: any[] = [];
|
const params: any[] = [];
|
||||||
let query = ` SELECT *, UNIX_TIMESTAMP(blocks.blockTimestamp) as blockTimestamp,
|
let query = ` SELECT *, UNIX_TIMESTAMP(blocks.blockTimestamp) as blockTimestamp,
|
||||||
previous_block_hash as previousblockhash
|
previous_block_hash as previousblockhash
|
||||||
@ -243,7 +243,7 @@ class BlocksRepository {
|
|||||||
WHERE pool_id = ?`;
|
WHERE pool_id = ?`;
|
||||||
params.push(poolId);
|
params.push(poolId);
|
||||||
|
|
||||||
if (startHeight) {
|
if (startHeight !== undefined) {
|
||||||
query += ` AND height < ?`;
|
query += ` AND height < ?`;
|
||||||
params.push(startHeight);
|
params.push(startHeight);
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ class Routes {
|
|||||||
try {
|
try {
|
||||||
const poolBlocks = await BlocksRepository.$getBlocksByPool(
|
const poolBlocks = await BlocksRepository.$getBlocksByPool(
|
||||||
parseInt(req.params.poolId, 10),
|
parseInt(req.params.poolId, 10),
|
||||||
parseInt(req.params.height, 10) ?? null,
|
req.params.height === undefined ? undefined : parseInt(req.params.height, 10),
|
||||||
);
|
);
|
||||||
res.header('Pragma', 'public');
|
res.header('Pragma', 'public');
|
||||||
res.header('Cache-control', 'public');
|
res.header('Cache-control', 'public');
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="label">Tags</td>
|
<td class="label">Tags</td>
|
||||||
<td class="text-truncate">
|
<td class="text-truncate" *ngIf="poolStats.pool.regexes.length else nodata">
|
||||||
<div class="scrollable">
|
<div class="scrollable">
|
||||||
{{ poolStats.pool.regexes }}
|
{{ poolStats.pool.regexes }}
|
||||||
</div>
|
</div>
|
||||||
@ -22,15 +22,15 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="label">Addresses</td>
|
<td class="label">Addresses</td>
|
||||||
<td class="text-truncate" *ngIf="poolStats.pool.addresses.length else noaddress">
|
<td class="text-truncate" *ngIf="poolStats.pool.addresses.length else nodata">
|
||||||
<div class="scrollable">
|
<div class="scrollable">
|
||||||
<a *ngFor="let address of poolStats.pool.addresses"
|
<a *ngFor="let address of poolStats.pool.addresses"
|
||||||
[routerLink]="['/address' | relativeUrl, address]">{{
|
[routerLink]="['/address' | relativeUrl, address]">{{
|
||||||
address }}<br></a>
|
address }}<br></a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<ng-template #noaddress>
|
<ng-template #nodata>
|
||||||
<td>~</td>
|
<td class="right-mobile">~</td>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -168,7 +168,7 @@
|
|||||||
<div class="skeleton-loader"></div>
|
<div class="skeleton-loader"></div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<ng-template #noaddress>
|
<ng-template #nodata>
|
||||||
<td>~</td>
|
<td>~</td>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -131,3 +131,9 @@ div.scrollable {
|
|||||||
width: auto;
|
width: auto;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.right-mobile {
|
||||||
|
@media (max-width: 450px) {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user