diff --git a/src/main/java/app/services/db/DetectService.java b/src/main/java/app/services/db/DetectService.java index 28a3242..8c8a6a8 100644 --- a/src/main/java/app/services/db/DetectService.java +++ b/src/main/java/app/services/db/DetectService.java @@ -81,7 +81,7 @@ public class DetectService { } public List> getAttachedDiscordAccountPerSteam(SteamID steamID) { - return jdbcTemplate_ro.query("SELECT discord_id, extract(epoch from timestamp) as utime, active FROM steam2discord WHERE steam_id LIKE ? GROUP BY discord_id", + return jdbcTemplate_ro.query("SELECT discord_id, extract(epoch from timestamp) as utime, active FROM steam2discord WHERE steam_id LIKE ? GROUP BY discord_id, active, timestamp", new Object[]{ steamID.steam2 }, (rs, n) -> Map.of("discord_id", rs.getObject("discord_id"), "utime", rs.getObject("utime"), "active", rs.getObject("active"))); } diff --git a/src/main/java/app/services/db/UsertimeService.java b/src/main/java/app/services/db/UsertimeService.java index 95438d2..806a4a7 100644 --- a/src/main/java/app/services/db/UsertimeService.java +++ b/src/main/java/app/services/db/UsertimeService.java @@ -101,13 +101,13 @@ public class UsertimeService { } public List getMap(String db, int limit) { - return jdbcTemplate.query("select distinct map from "+db+".user_connections WHERE true ORDER BY user_connections.id DESC LIMIT ?", + return jdbcTemplate.query("select map from "+db+".user_connections WHERE true group by map, id ORDER BY user_connections.id DESC LIMIT ?", new Object[]{ limit }, (rs, n) -> rs.getString("map")); } public List getMaps(String db) { - return jdbcTemplate.query("select distinct map from "+db+".user_connections", + return jdbcTemplate.query("select map from "+db+".user_connections group by map", (rs, n) -> rs.getString("map")); }