fixed front-end stats undefined bug

This commit is contained in:
cubedro 2015-04-28 12:01:34 +03:00
parent 13680815f1
commit e9618aac5c

View File

@ -124,9 +124,12 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
data.stats.hashrate = 0;
var index = findIndex({id: data.id});
if(typeof $scope.nodes[index].stats !== 'undefined') {
$scope.nodes[index].stats = data.stats;
$scope.nodes[index].history = data.history;
makePeerPropagationChart($scope.nodes[index]);
}
break;
@ -174,6 +177,9 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
break;
case "latency":
var node = $scope.nodes[findIndex({id: data.id})];
if(typeof node.stats !== 'undefined' && typeof node.stats.latency !== 'undefined')
$scope.nodes[findIndex({id: data.id})].stats.latency = data.latency;
break;