hashrate is a number not a string
This commit is contained in:
		
							parent
							
								
									833418514e
								
							
						
					
					
						commit
						e11ce14f81
					
				| @ -78,17 +78,17 @@ export class ActiveAccelerationBox implements OnChanges { | ||||
|       if (!pool) { | ||||
|         continue; | ||||
|       } | ||||
|       totalAcceleratedHashrate += parseFloat(pool.lastEstimatedHashrate); | ||||
|       totalAcceleratedHashrate += pool.lastEstimatedHashrate; | ||||
|     } | ||||
|     this.acceleratedByPercentage = ((totalAcceleratedHashrate / parseFloat(this.miningStats.lastEstimatedHashrate)) * 100).toFixed(1) + '%'; | ||||
|     this.acceleratedByPercentage = ((totalAcceleratedHashrate / this.miningStats.lastEstimatedHashrate) * 100).toFixed(1) + '%'; | ||||
|     data.push(getDataItem( | ||||
|       totalAcceleratedHashrate, | ||||
|       'var(--mainnet-alt)', | ||||
|       `${this.acceleratedByPercentage} accelerating`, | ||||
|     ) as PieSeriesOption); | ||||
|     const notAcceleratedByPercentage = ((1 - (totalAcceleratedHashrate / parseFloat(this.miningStats.lastEstimatedHashrate))) * 100).toFixed(1) + '%'; | ||||
|     const notAcceleratedByPercentage = ((1 - (totalAcceleratedHashrate / this.miningStats.lastEstimatedHashrate)) * 100).toFixed(1) + '%'; | ||||
|     data.push(getDataItem( | ||||
|       (parseFloat(this.miningStats.lastEstimatedHashrate) - totalAcceleratedHashrate), | ||||
|       (this.miningStats.lastEstimatedHashrate - totalAcceleratedHashrate), | ||||
|       'rgba(127, 127, 127, 0.3)', | ||||
|       `${notAcceleratedByPercentage} not accelerating`, | ||||
|     ) as PieSeriesOption); | ||||
|  | ||||
| @ -163,7 +163,7 @@ export class PoolRankingComponent implements OnInit { | ||||
|             const i = pool.blockCount.toString(); | ||||
|             if (this.miningWindowPreference === '24h') { | ||||
|               return `<b style="color: white">${pool.name} (${pool.share}%)</b><br>` + | ||||
|                 pool.lastEstimatedHashrate.toString() + ' ' + miningStats.miningUnits.hashrateUnit + | ||||
|                 pool.lastEstimatedHashrate.toFixed(2) + ' ' + miningStats.miningUnits.hashrateUnit + | ||||
|                 `<br>` + $localize`${ i }:INTERPOLATION: blocks`; | ||||
|             } else { | ||||
|               return `<b style="color: white">${pool.name} (${pool.share}%)</b><br>` + | ||||
| @ -291,7 +291,7 @@ export class PoolRankingComponent implements OnInit { | ||||
|    */ | ||||
|   getEmptyMiningStat(): MiningStats { | ||||
|     return { | ||||
|       lastEstimatedHashrate: 'Error', | ||||
|       lastEstimatedHashrate: 0, | ||||
|       blockCount: 0, | ||||
|       totalEmptyBlock: 0, | ||||
|       totalEmptyBlockRatio: '', | ||||
|  | ||||
| @ -140,7 +140,7 @@ export interface SinglePoolStats { | ||||
|   emptyBlocks: number; | ||||
|   rank: number; | ||||
|   share: number; | ||||
|   lastEstimatedHashrate: string; | ||||
|   lastEstimatedHashrate: number; | ||||
|   emptyBlockRatio: string; | ||||
|   logo: string; | ||||
|   slug: string; | ||||
|  | ||||
| @ -12,7 +12,7 @@ export interface MiningUnits { | ||||
| } | ||||
| 
 | ||||
| export interface MiningStats { | ||||
|   lastEstimatedHashrate: string; | ||||
|   lastEstimatedHashrate: number; | ||||
|   blockCount: number; | ||||
|   totalEmptyBlock: number; | ||||
|   totalEmptyBlockRatio: string; | ||||
| @ -111,7 +111,7 @@ export class MiningService { | ||||
|     const poolsStats = stats.pools.map((poolStat) => { | ||||
|       return { | ||||
|         share: parseFloat((poolStat.blockCount / stats.blockCount * 100).toFixed(2)), | ||||
|         lastEstimatedHashrate: (poolStat.blockCount / stats.blockCount * stats.lastEstimatedHashrate / hashrateDivider).toFixed(2), | ||||
|         lastEstimatedHashrate: poolStat.blockCount / stats.blockCount * stats.lastEstimatedHashrate / hashrateDivider, | ||||
|         emptyBlockRatio: (poolStat.emptyBlocks / poolStat.blockCount * 100).toFixed(2), | ||||
|         logo: `/resources/mining-pools/` + poolStat.slug + '.svg', | ||||
|         ...poolStat | ||||
| @ -119,7 +119,7 @@ export class MiningService { | ||||
|     }); | ||||
| 
 | ||||
|     return { | ||||
|       lastEstimatedHashrate: (stats.lastEstimatedHashrate / hashrateDivider).toFixed(2), | ||||
|       lastEstimatedHashrate: stats.lastEstimatedHashrate / hashrateDivider, | ||||
|       blockCount: stats.blockCount, | ||||
|       totalEmptyBlock: totalEmptyBlock, | ||||
|       totalEmptyBlockRatio: totalEmptyBlockRatio, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user