added hashrate units
This commit is contained in:
parent
7557ccf438
commit
3a81372329
@ -334,9 +334,9 @@ History.prototype.getAvgHashrate = function()
|
||||
})
|
||||
.value();
|
||||
|
||||
var avgBlocktime = _.sum(blocktimeHistory) / blocktimeHistory.length;
|
||||
var avgBlocktime = (_.sum(blocktimeHistory) / blocktimeHistory.length)/1000;
|
||||
|
||||
return avgDifficulty / 1000 * 12 * ( 12 / avgBlocktime );
|
||||
return avgDifficulty * 12 * ( 12 / avgBlocktime );
|
||||
}
|
||||
|
||||
History.prototype.getMinersCount = function()
|
||||
|
@ -231,6 +231,35 @@ angular.module('netStatsApp.filters', [])
|
||||
return moment.duration(Math.round(diff), 's').humanize() + ' ago';
|
||||
};
|
||||
})
|
||||
.filter('networkHashrateFilter', function($sce) {
|
||||
return function(hashes) {
|
||||
var result = 0;
|
||||
|
||||
if(hashes < 1000) {
|
||||
return $sce.trustAsHtml(result.toFixed(1) + ' <span class="small">H/s</span>');
|
||||
}
|
||||
|
||||
if(hashes < Math.pow(1000, 2)) {
|
||||
result = hashes / 1000;
|
||||
return $sce.trustAsHtml(result.toFixed(1) + ' <span class="small">KH/s</span>');
|
||||
}
|
||||
|
||||
if(hashes < Math.pow(1000, 3)) {
|
||||
result = hashes / Math.pow(1000, 2);
|
||||
return $sce.trustAsHtml(result.toFixed(1) + ' <span class="small">MH/s</span>');
|
||||
}
|
||||
|
||||
if(hashes < Math.pow(1000, 4)) {
|
||||
result = hashes / Math.pow(1000, 3);
|
||||
return $sce.trustAsHtml(result.toFixed(1) + ' <span class="small">GH/s</span>');
|
||||
}
|
||||
|
||||
if(hashes < Math.pow(1000, 5)) {
|
||||
result = hashes / Math.pow(1000, 4);
|
||||
return $sce.trustAsHtml(result.toFixed(1) + ' <span class="small">TH/s</span>');
|
||||
}
|
||||
};
|
||||
})
|
||||
.filter('blockPropagationFilter', function() {
|
||||
return function(ms, prefix) {
|
||||
if(typeof prefix === 'undefined')
|
||||
|
@ -42,7 +42,7 @@ block content
|
||||
i.icon-hashrate
|
||||
div.big-details-holder
|
||||
span.small-title avg network hashrate
|
||||
span.big-details {{ avgHashrate | number : 1 }} MH/s
|
||||
span.big-details(ng-bind-html="avgHashrate | networkHashrateFilter")
|
||||
div.clearfix
|
||||
div.col-xs-2.stat-holder
|
||||
div.big-info.difficulty.text-danger
|
||||
|
Loading…
Reference in New Issue
Block a user