mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-07 04:18:26 +02:00
Fixed multiples of same geolocation on player page
This commit is contained in:
parent
63434cc8e0
commit
5021ada67f
@ -89,6 +89,7 @@ public class GeoInfo implements DateHolder, Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public String getIp() {
|
public String getIp() {
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,12 @@ public class GeoInfoQueries {
|
|||||||
* @return List of {@link GeoInfo}, empty if none are found.
|
* @return List of {@link GeoInfo}, empty if none are found.
|
||||||
*/
|
*/
|
||||||
public static Query<List<GeoInfo>> fetchPlayerGeoInformation(UUID playerUUID) {
|
public static Query<List<GeoInfo>> fetchPlayerGeoInformation(UUID playerUUID) {
|
||||||
String sql = SELECT + DISTINCT + '*' + FROM + GeoInfoTable.TABLE_NAME +
|
String sql = SELECT +
|
||||||
WHERE + GeoInfoTable.USER_UUID + "=?";
|
GeoInfoTable.GEOLOCATION +
|
||||||
|
",MAX(" + GeoInfoTable.LAST_USED + ") as " + GeoInfoTable.LAST_USED +
|
||||||
|
FROM + GeoInfoTable.TABLE_NAME +
|
||||||
|
WHERE + GeoInfoTable.USER_UUID + "=?" +
|
||||||
|
GROUP_BY + GeoInfoTable.GEOLOCATION;
|
||||||
|
|
||||||
return new QueryStatement<List<GeoInfo>>(sql, 100) {
|
return new QueryStatement<List<GeoInfo>>(sql, 100) {
|
||||||
@Override
|
@Override
|
||||||
@ -99,10 +103,9 @@ public class GeoInfoQueries {
|
|||||||
public List<GeoInfo> processResults(ResultSet set) throws SQLException {
|
public List<GeoInfo> processResults(ResultSet set) throws SQLException {
|
||||||
List<GeoInfo> geoInfo = new ArrayList<>();
|
List<GeoInfo> geoInfo = new ArrayList<>();
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
String ip = set.getString(GeoInfoTable.IP);
|
|
||||||
String geolocation = set.getString(GeoInfoTable.GEOLOCATION);
|
String geolocation = set.getString(GeoInfoTable.GEOLOCATION);
|
||||||
long lastUsed = set.getLong(GeoInfoTable.LAST_USED);
|
long lastUsed = set.getLong(GeoInfoTable.LAST_USED);
|
||||||
geoInfo.add(new GeoInfo(ip, geolocation, lastUsed));
|
geoInfo.add(new GeoInfo("", geolocation, lastUsed));
|
||||||
}
|
}
|
||||||
return geoInfo;
|
return geoInfo;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user