From 3c7957911c95e9f5d305f7de8d7fa6a51d61cc3c Mon Sep 17 00:00:00 2001 From: cubedro Date: Thu, 26 Mar 2015 17:01:44 +0200 Subject: [PATCH] added block number check --- public/js/controllers.js | 4 +++- views/index.jade | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/js/controllers.js b/public/js/controllers.js index ff10b3a..53a4dfd 100644 --- a/public/js/controllers.js +++ b/public/js/controllers.js @@ -69,7 +69,9 @@ function StatsCtrl($scope, $filter, socket, _, toastr) { break; case "update": - 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' && $scope.nodes[findIndex({id: data.id})].stats.block.number != data.stats.block.number){ + data.stats.block.when = (new Date()).getTime() - data.stats.block.arrival; + } $scope.nodes[findIndex({id: data.id})].stats = data.stats; break; diff --git a/views/index.jade b/views/index.jade index 5504a30..05d8a3f 100644 --- a/views/index.jade +++ b/views/index.jade @@ -128,5 +128,5 @@ block content //- div.small Difficulty: {{node.stats.block.difficulty | gasFilter}} | Gas used: {{node.stats.block.gasUsed | gasFilter}} | Min gas price: {{node.stats.block.minGasPrice | gasFilter}} | Gas limit: {{node.stats.block.gasLimit | gasFilter}} td(style="padding-left: 18px;") {{node.stats.block.txCount}} td(class="{{ node.stats.block.timestamp | timeClass }}") {{node.stats.block.timestamp | blockTimeFilter }} - td(class="{{ node.stats.block.propagation | propagationTimeClass }}") {{node.stats.block.when | blockPropagationFilter}} + td(class="{{ node.stats.block.when | propagationTimeClass }}") {{node.stats.block.when | blockPropagationFilter}} td(class="{{ node.stats.uptime | upTimeClass }}") {{ node.stats.uptime | upTimeFilter }}