From 18806c91c3216e573905032d40f6eb8a5dbf715b Mon Sep 17 00:00:00 2001 From: cubedro Date: Thu, 5 Mar 2015 00:20:57 +0200 Subject: [PATCH] fixed propagation filter --- public/js/filters.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/public/js/filters.js b/public/js/filters.js index b117211..c7fc4bf 100644 --- a/public/js/filters.js +++ b/public/js/filters.js @@ -115,29 +115,30 @@ angular.module('netStatsApp.filters', []) }; }) .filter('blockPropagationFilter', function() { - return function(miliseconds) { - if(miliseconds < 1000) - return miliseconds + " ms"; - + return function(ms) { var result = 0; - if(miliseconds < 1000*60){ - result = miliseconds/1000; - return result.format(1) + " s"; + if(ms < 1000){ + return ms + " ms"; } - if(miliseconds < 1000*60*60){ - result = miliseconds/1000/60; - return result.format(1) + " min"; + if(ms < 1000*60){ + result = ms/1000; + return result.toFixed(1).toString() + " s"; } - if(miliseconds < 1000*60*60*24){ - result = miliseconds/1000/60/60; - return result.format(1) + " h"; + if(ms < 1000*60*60){ + result = ms/1000/60; + return result.toFixed(1) + " min"; } - result = miliseconds/1000/60/60/24; - return result.format(1) + " days"; + if(ms < 1000*60*60*24){ + result = ms/1000/60/60; + return result.toFixed(1) + " h"; + } + + result = ms/1000/60/60/24; + return result.toFixed(1) + " days"; }; }) .filter('avgTimeFilter', function() {