fixed propagation filter

This commit is contained in:
cubedro 2015-03-05 00:20:57 +02:00
parent 41b9002863
commit 18806c91c3

View File

@ -115,29 +115,30 @@ angular.module('netStatsApp.filters', [])
}; };
}) })
.filter('blockPropagationFilter', function() { .filter('blockPropagationFilter', function() {
return function(miliseconds) { return function(ms) {
if(miliseconds < 1000)
return miliseconds + " ms";
var result = 0; var result = 0;
if(miliseconds < 1000*60){ if(ms < 1000){
result = miliseconds/1000; return ms + " ms";
return result.format(1) + " s";
} }
if(miliseconds < 1000*60*60){ if(ms < 1000*60){
result = miliseconds/1000/60; result = ms/1000;
return result.format(1) + " min"; return result.toFixed(1).toString() + " s";
} }
if(miliseconds < 1000*60*60*24){ if(ms < 1000*60*60){
result = miliseconds/1000/60/60; result = ms/1000/60;
return result.format(1) + " h"; return result.toFixed(1) + " min";
} }
result = miliseconds/1000/60/60/24; if(ms < 1000*60*60*24){
return result.format(1) + " days"; result = ms/1000/60/60;
return result.toFixed(1) + " h";
}
result = ms/1000/60/60/24;
return result.toFixed(1) + " days";
}; };
}) })
.filter('avgTimeFilter', function() { .filter('avgTimeFilter', function() {