fixed bug in collection of per algo hash rate string

This commit is contained in:
Jerry Brady 2014-04-03 02:04:39 +00:00
parent 5918baac2f
commit 795b93e254
1 changed files with 4 additions and 3 deletions

View File

@ -157,7 +157,8 @@ module.exports = function(logger, portalConfig, poolConfigs){
});
Object.keys(portalStats.algos).forEach(function(algo){
algo.hashrateString = _this.getReadableHashRateString(algo.hashrate);
var algoStats = portalStats.algos[algo];
algoStats.hashrateString = _this.getReadableHashRateString(algoStats.hashrate);
});
_this.stats = portalStats;
@ -169,10 +170,10 @@ module.exports = function(logger, portalConfig, poolConfigs){
this.getReadableHashRateString = function(hashrate){
var i = -1;
var byteUnits = [' KH', ' MH', ' GH', ' TH', 'PH' ];
var byteUnits = [ ' KH', ' MH', ' GH', ' TH', ' PH' ];
do {
hashrate = hashrate / 1024;
i++;
i++;
} while (hashrate > 1024);
return hashrate.toFixed(2) + byteUnits[i];
};