Fix hashrate bug and add stats by algorithm to index and stats pages

This commit is contained in:
Jerry Brady 2014-04-04 02:55:35 +00:00
parent 795b93e254
commit 71024f18dc
3 changed files with 34 additions and 11 deletions

View File

@ -135,8 +135,7 @@ module.exports = function(logger, portalConfig, poolConfigs){
});
var shareMultiplier = algos[coinStats.algorithm].multiplier || 0;
var hashratePre = shareMultiplier * coinStats.shares / portalConfig.website.hashrateWindow;
coinStats.hashrate = hashratePre / 1e3 | 0;
portalStats.global.hashrate += coinStats.hashrate;
coinStats.hashrate = hashratePre | 0;
portalStats.global.workers += Object.keys(coinStats.workers).length;
/* algorithm specific global stats */

View File

@ -50,10 +50,12 @@
</li>
</ul>
<div class="stats">
<div><i class="fa fa-users"></i>&nbsp;<span id="statsMiners">{{=it.stats.global.workers}}</span> Miners</div>
<div><i class="fa fa-tachometer"></i>&nbsp;<span id="statsHashrate">{{=it.stats.global.hashrate}}</span> KH/s</div>
</div>
{{ for(var algo in it.stats.algos) { }}
{{=algo}}: <div class="stats">
<div><i class="fa fa-users"></i>&nbsp;<span id="statsMiners{{=algo}}">{{=it.stats.algos[algo].workers}}</span> Miners</div>
<div><i class="fa fa-tachometer"></i>&nbsp;<span id="statsHashrate{{=algo}}">{{=it.stats.algos[algo].hashrateString}}</span></div>
</div>&nbsp;
{{ } }}
</div>
</header>
@ -86,4 +88,4 @@
</body>
</html>
</html>

View File

@ -1,5 +1,27 @@
<div>
fancy graphs here
<br>
{{=JSON.stringify(it.stats)}}
</div>
<table class="pure-table">
<thead>
<tr>
<th>Pool</th>
<th>Algo</th>
<th>Workers</th>
<th>Valid Shares</th>
<th>Invalid Shares</th>
<th>Blocks</th>
<th>Hashrate</th>
</tr>
</tr>
</thead>
{{ for(var pool in it.stats.pools) { }}
<tr class="pure-table-odd">
<td>{{=it.stats.pools[pool].name}}</td>
<td>{{=it.stats.pools[pool].algorithm}}</td>
<td>{{=Object.keys(it.stats.pools[pool].workers).length}}</td>
<td>{{=it.stats.pools[pool].poolStats.validShares}}</td>
<td>{{=it.stats.pools[pool].poolStats.invalidShares}}</td>
<td>{{=it.stats.pools[pool].poolStats.validBlocks}}</td>
<td>{{=it.stats.pools[pool].hashrateString}}</div>
</tr>
{{ } }}
</table>
</div>