Merge pull request #117 from cubedro/develop

Fixed last block time bug
pull/5/head
Marian OANCΞA 10 years ago
commit 39c426e718
  1. 16
      public/js/controllers.js
  2. 2
      views/index.jade

@ -127,6 +127,20 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
var index = findIndex({id: data.id});
if(typeof $scope.nodes[index].stats !== 'undefined') {
if($scope.nodes[index].stats.block.number < data.stats.block.number)
{
var best = _.max($scope.nodes, function(node) {
return parseInt(node.stats.block.number);
}).stats.block;
if (data.stats.block.number > best.number) {
data.stats.block.arrived = _.now();
} else {
data.stats.block.arrived = best.arrived;
}
}
$scope.nodes[index].stats = data.stats;
$scope.nodes[index].history = data.history;
makePeerPropagationChart($scope.nodes[index]);
@ -285,7 +299,7 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
return parseInt(node.stats.block.number);
}).stats;
$scope.lastBlock = $scope.bestStats.block.received;
$scope.lastBlock = $scope.bestStats.block.arrived;
$scope.lastDifficulty = $scope.bestStats.block.difficulty;
}

@ -195,7 +195,7 @@ block content
span.small {{node.stats.block.hash | hashFilter}}
td(style="padding-left: 14px;") {{node.stats.block.transactions.length || 0}}
td(style="padding-left: 14px;") {{node.stats.block.uncles.length || 0}}
td(class="{{ node.stats.block.arrived | timeClass : node.stats.active }}") {{node.stats.block.arrived | blockTimeFilter }}
td(class="{{ node.stats.block.received | timeClass : node.stats.active }}") {{node.stats.block.received | blockTimeFilter }}
td(class="{{ node.stats | propagationTimeClass : bestBlock }}")
div.propagationBox
span {{node.stats.block.propagation | blockPropagationFilter}}

Loading…
Cancel
Save