From 51ab249429f896ac3d4bf55ca41142a8dbf024f0 Mon Sep 17 00:00:00 2001 From: cubedro Date: Thu, 26 Mar 2015 17:04:57 +0200 Subject: [PATCH] fixed arrival updating to NaN --- public/js/controllers.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/js/controllers.js b/public/js/controllers.js index 53a4dfd..5c94201 100644 --- a/public/js/controllers.js +++ b/public/js/controllers.js @@ -69,8 +69,12 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { break; case "update": - if(typeof $scope.nodes[findIndex({id: data.id})].stats !== 'undefined' && typeof $scope.nodes[findIndex({id: data.id})].stats.block !== 'undefined' && $scope.nodes[findIndex({id: data.id})].stats.block.number != data.stats.block.number){ - data.stats.block.when = (new Date()).getTime() - data.stats.block.arrival; + if(typeof $scope.nodes[findIndex({id: data.id})].stats !== 'undefined' && typeof $scope.nodes[findIndex({id: data.id})].stats.block !== 'undefined'){ + if($scope.nodes[findIndex({id: data.id})].stats.block.number != data.stats.block.number){ + data.stats.block.when = (new Date()).getTime() - data.stats.block.arrival; + } else { + data.stats.block.when = $scope.nodes[findIndex({id: data.id})].stats.block.when; + } } $scope.nodes[findIndex({id: data.id})].stats = data.stats; break;