mirror of
https://github.com/mempool/mempool.git
synced 2025-02-22 22:25:34 +01:00
Merge pull request #3940 from mempool/mononaut/null-miner-health
Unknown avg miner health
This commit is contained in:
commit
7542d95bc5
1 changed files with 3 additions and 3 deletions
|
@ -401,7 +401,7 @@ class BlocksRepository {
|
|||
/**
|
||||
* Get average block health for all blocks for a single pool
|
||||
*/
|
||||
public async $getAvgBlockHealthPerPoolId(poolId: number): Promise<number> {
|
||||
public async $getAvgBlockHealthPerPoolId(poolId: number): Promise<number | null> {
|
||||
const params: any[] = [];
|
||||
const query = `
|
||||
SELECT AVG(blocks_audits.match_rate) AS avg_match_rate
|
||||
|
@ -413,8 +413,8 @@ class BlocksRepository {
|
|||
|
||||
try {
|
||||
const [rows] = await DB.query(query, params);
|
||||
if (!rows[0] || !rows[0].avg_match_rate) {
|
||||
return 0;
|
||||
if (!rows[0] || rows[0].avg_match_rate == null) {
|
||||
return null;
|
||||
}
|
||||
return Math.round(rows[0].avg_match_rate * 100) / 100;
|
||||
} catch (e) {
|
||||
|
|
Loading…
Add table
Reference in a new issue