Merge branch 'master' into junderw/pushtxantidos
This commit is contained in:
		
						commit
						da4f7a3aba
					
				@ -401,7 +401,7 @@ class BlocksRepository {
 | 
				
			|||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * Get average block health for all blocks for a single pool
 | 
					   * 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 params: any[] = [];
 | 
				
			||||||
    const query = `
 | 
					    const query = `
 | 
				
			||||||
      SELECT AVG(blocks_audits.match_rate) AS avg_match_rate
 | 
					      SELECT AVG(blocks_audits.match_rate) AS avg_match_rate
 | 
				
			||||||
@ -413,8 +413,8 @@ class BlocksRepository {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
      const [rows] = await DB.query(query, params);
 | 
					      const [rows] = await DB.query(query, params);
 | 
				
			||||||
      if (!rows[0] || !rows[0].avg_match_rate) {
 | 
					      if (!rows[0] || rows[0].avg_match_rate == null) {
 | 
				
			||||||
        return 0;
 | 
					        return null;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return Math.round(rows[0].avg_match_rate * 100) / 100;
 | 
					      return Math.round(rows[0].avg_match_rate * 100) / 100;
 | 
				
			||||||
    } catch (e) {
 | 
					    } catch (e) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user