diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/TPSQueries.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/TPSQueries.java index c20bd3339..0d97099a3 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/TPSQueries.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/TPSQueries.java @@ -21,7 +21,6 @@ import com.djrapitops.plan.gathering.domain.TPS; import com.djrapitops.plan.gathering.domain.builders.TPSBuilder; import com.djrapitops.plan.storage.database.queries.Query; import com.djrapitops.plan.storage.database.queries.QueryStatement; -import com.djrapitops.plan.storage.database.sql.building.Select; import com.djrapitops.plan.storage.database.sql.tables.ServerTable; import com.djrapitops.plan.utilities.java.Lists; @@ -129,10 +128,11 @@ public class TPSQueries { } public static Query> fetchTPSDataOfServer(long after, long before, UUID serverUUID) { - String sql = Select.all(TABLE_NAME) - .where(SERVER_ID + "=" + ServerTable.STATEMENT_SELECT_SERVER_ID) - .and(DATE + ">=?").and(DATE + "<=?") - .toString(); + String sql = SELECT + "*" + FROM + TABLE_NAME + + WHERE + SERVER_ID + "=" + ServerTable.STATEMENT_SELECT_SERVER_ID + + AND + DATE + ">=?" + + AND + DATE + "<=?" + + ORDER_BY + DATE; return new QueryStatement>(sql, 50000) { @Override diff --git a/Plan/common/src/test/java/com/djrapitops/plan/storage/database/queries/TPSQueriesTest.java b/Plan/common/src/test/java/com/djrapitops/plan/storage/database/queries/TPSQueriesTest.java index 81651ded5..c321395d1 100644 --- a/Plan/common/src/test/java/com/djrapitops/plan/storage/database/queries/TPSQueriesTest.java +++ b/Plan/common/src/test/java/com/djrapitops/plan/storage/database/queries/TPSQueriesTest.java @@ -22,6 +22,7 @@ import com.djrapitops.plan.storage.database.DatabaseTestPreparer; import com.djrapitops.plan.storage.database.queries.objects.TPSQueries; import com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction; import com.djrapitops.plan.storage.database.transactions.events.TPSStoreTransaction; +import com.djrapitops.plan.utilities.comparators.TPSComparator; import com.djrapitops.plan.utilities.java.Lists; import org.junit.jupiter.api.Test; import utilities.RandomData; @@ -44,6 +45,7 @@ public interface TPSQueriesTest extends DatabaseTestPreparer { forcePersistenceCheck(); + expected.sort(new TPSComparator()); assertEquals(expected, db().query(TPSQueries.fetchTPSDataOfServer(Long.MIN_VALUE, Long.MAX_VALUE, serverUUID()))); }