From f2ce10738cdb047db2884c841e53a76935491264 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Wed, 22 Nov 2017 10:02:34 +0200 Subject: [PATCH] IP table now sorts properly --- .../plan/utilities/html/tables/IpTableCreator.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/IpTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/IpTableCreator.java index c489ea594..8a6469852 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/IpTableCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/IpTableCreator.java @@ -6,6 +6,7 @@ package main.java.com.djrapitops.plan.utilities.html.tables; import main.java.com.djrapitops.plan.data.GeoInfo; import main.java.com.djrapitops.plan.utilities.FormatUtils; +import main.java.com.djrapitops.plan.utilities.comparators.GeoInfoComparator; import main.java.com.djrapitops.plan.utilities.html.Html; import java.util.List; @@ -23,19 +24,18 @@ public class IpTableCreator { } public static String createTable(List geoInfo) { + geoInfo.sort(new GeoInfoComparator()); StringBuilder html = new StringBuilder(); if (geoInfo.isEmpty()) { html.append(Html.TABLELINE_3.parse("No Connections", "-", "-")); } else { - int i = 0; for (GeoInfo info : geoInfo) { + long date = info.getDate(); html.append(Html.TABLELINE_3.parse( FormatUtils.formatIP(info.getIp()), info.getGeolocation(), - FormatUtils.formatTimeStampYear(info.getDate()) + date != 0 ? FormatUtils.formatTimeStampYear(date) : "-" )); - - i++; } } return html.toString();