Fixed a network page query

This commit is contained in:
Rsl1122 2019-02-18 17:57:38 +02:00
parent bbb158ddc5
commit 8f3f2e9127
2 changed files with 8 additions and 1 deletions

View File

@ -88,7 +88,6 @@ public class ServerAggregateQueries {
*/ */
public static Query<Map<UUID, Integer>> serverUserCounts() { public static Query<Map<UUID, Integer>> serverUserCounts() {
String sql = "SELECT COUNT(1) as c, " + UserInfoTable.SERVER_UUID + FROM + UserInfoTable.TABLE_NAME + String sql = "SELECT COUNT(1) as c, " + UserInfoTable.SERVER_UUID + FROM + UserInfoTable.TABLE_NAME +
WHERE + UserInfoTable.SERVER_UUID + "=?" +
GROUP_BY + UserInfoTable.SERVER_UUID; GROUP_BY + UserInfoTable.SERVER_UUID;
return new QueryAllStatement<Map<UUID, Integer>>(sql, 100) { return new QueryAllStatement<Map<UUID, Integer>>(sql, 100) {
@Override @Override

View File

@ -1009,4 +1009,12 @@ public abstract class CommonDBTest {
assertEquals("Wrong return value. " + tpsData.stream().map(TPS::getPlayers).collect(Collectors.toList()).toString(), expected, actual); assertEquals("Wrong return value. " + tpsData.stream().map(TPS::getPlayers).collect(Collectors.toList()).toString(), expected, actual);
} }
@Test
public void playerCountForServersIsCorrect() {
Map<UUID, Integer> expected = Collections.singletonMap(serverUUID, 1);
saveUserOne();
Map<UUID, Integer> result = db.query(ServerAggregateQueries.serverUserCounts());
assertEquals(expected, result);
}
} }