From 41fed984cbac076a0d0569825f6808ccfed7560c Mon Sep 17 00:00:00 2001 From: nymkappa Date: Wed, 16 Mar 2022 20:19:39 +0100 Subject: [PATCH] Fix pool get blocks API undefined start block behavior --- backend/src/repositories/BlocksRepository.ts | 4 ++-- backend/src/routes.ts | 2 +- frontend/src/app/components/pool/pool.component.html | 10 +++++----- frontend/src/app/components/pool/pool.component.scss | 6 ++++++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/backend/src/repositories/BlocksRepository.ts b/backend/src/repositories/BlocksRepository.ts index fb9b48eba..40c705bdb 100644 --- a/backend/src/repositories/BlocksRepository.ts +++ b/backend/src/repositories/BlocksRepository.ts @@ -235,7 +235,7 @@ class BlocksRepository { /** * Get blocks mined by a specific mining pool */ - public async $getBlocksByPool(poolId: number, startHeight: number | null = null): Promise { + public async $getBlocksByPool(poolId: number, startHeight: number | undefined = undefined): Promise { const params: any[] = []; let query = ` SELECT *, UNIX_TIMESTAMP(blocks.blockTimestamp) as blockTimestamp, previous_block_hash as previousblockhash @@ -243,7 +243,7 @@ class BlocksRepository { WHERE pool_id = ?`; params.push(poolId); - if (startHeight) { + if (startHeight !== undefined) { query += ` AND height < ?`; params.push(startHeight); } diff --git a/backend/src/routes.ts b/backend/src/routes.ts index 7f3a98296..870c62ab8 100644 --- a/backend/src/routes.ts +++ b/backend/src/routes.ts @@ -553,7 +553,7 @@ class Routes { try { const poolBlocks = await BlocksRepository.$getBlocksByPool( 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('Cache-control', 'public'); diff --git a/frontend/src/app/components/pool/pool.component.html b/frontend/src/app/components/pool/pool.component.html index f22fb0bcb..bef441a85 100644 --- a/frontend/src/app/components/pool/pool.component.html +++ b/frontend/src/app/components/pool/pool.component.html @@ -14,7 +14,7 @@ Tags - +
{{ poolStats.pool.regexes }}
@@ -22,15 +22,15 @@ Addresses - + - - ~ + + ~ @@ -168,7 +168,7 @@
- + ~ diff --git a/frontend/src/app/components/pool/pool.component.scss b/frontend/src/app/components/pool/pool.component.scss index 3ecc2f227..2e8a4f154 100644 --- a/frontend/src/app/components/pool/pool.component.scss +++ b/frontend/src/app/components/pool/pool.component.scss @@ -131,3 +131,9 @@ div.scrollable { width: auto; text-align: left; } + +.right-mobile { + @media (max-width: 450px) { + text-align: right; + } +} \ No newline at end of file