Properly sort ping listing to ensure we don't wrongly smooth

This commit is contained in:
Cryptkeeper 2017-05-27 08:05:25 +08:00
parent 106033adb8
commit a250b3977a

View File

@ -54,6 +54,12 @@ function trimUselessPings(data) {
for (var x = 0; x < listing.length; x++) {
var entry = listing[x];
// Make sure we're sorted, otherwise the smoothing code below can
// select wrongly get an older (and worse) ping before one with players online.
listing.sort(function(a, b) {
return a[0] - b[0];
});
// 0 is the index of the timestamp.
// See the convertPingsToGraph method.
if (entry[0] - lastTimestamp >= 60 * 1000) {