From 795b93e254499027a751ada5b49861b231fcec94 Mon Sep 17 00:00:00 2001 From: Jerry Brady Date: Thu, 3 Apr 2014 02:04:39 +0000 Subject: [PATCH] fixed bug in collection of per algo hash rate string --- libs/stats.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/stats.js b/libs/stats.js index 10e4af0..5c31ccb 100644 --- a/libs/stats.js +++ b/libs/stats.js @@ -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]; };