Merge pull request #22 from cubedro/develop

fixed propagation filter
This commit is contained in:
Marian OANCΞA 2015-03-05 00:21:30 +02:00
commit 43cf4902e8

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() {