updated to handle new formatting
This commit is contained in:
parent
30145198f4
commit
a0879dd786
@ -21,7 +21,7 @@ public class MapBoardDTO {
|
|||||||
private String name;
|
private String name;
|
||||||
private String avatar;
|
private String avatar;
|
||||||
private int mapPoint;
|
private int mapPoint;
|
||||||
private String mapTime;
|
private Float mapTime;
|
||||||
private int position;
|
private int position;
|
||||||
private List<String> badgesUrls = new ArrayList();
|
private List<String> badgesUrls = new ArrayList();
|
||||||
|
|
||||||
@ -69,11 +69,11 @@ public class MapBoardDTO {
|
|||||||
this.mapPoint = mapPoint;
|
this.mapPoint = mapPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMapTime() {
|
public Float getMapTime() {
|
||||||
return mapTime;
|
return mapTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMapTime(String mapTime) {
|
public void setMapTime(Float mapTime) {
|
||||||
this.mapTime = mapTime;
|
this.mapTime = mapTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class MapValuesDTO {
|
|||||||
|
|
||||||
private int position;
|
private int position;
|
||||||
private String playerSteamID;
|
private String playerSteamID;
|
||||||
private String time;
|
private Float time;
|
||||||
private int mapPoints;
|
private int mapPoints;
|
||||||
|
|
||||||
public int getPosition() {
|
public int getPosition() {
|
||||||
@ -34,11 +34,11 @@ public class MapValuesDTO {
|
|||||||
this.playerSteamID = playerSteamID;
|
this.playerSteamID = playerSteamID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTime() {
|
public Float getTime() {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(String time) {
|
public void setTime(Float time) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public class PlayerMapBoardDTO {
|
|||||||
private String mapname;
|
private String mapname;
|
||||||
private int mapstage;
|
private int mapstage;
|
||||||
private int mapPoint;
|
private int mapPoint;
|
||||||
private String mapTime;
|
private Float mapTime;
|
||||||
private int position;
|
private int position;
|
||||||
|
|
||||||
public PlayerMapBoardDTO() {
|
public PlayerMapBoardDTO() {
|
||||||
|
@ -30,9 +30,29 @@ public class DataMapperCalls {
|
|||||||
public static Map.Entry<Collection<Player>, Collection<MapBoard>> getAllValues() {
|
public static Map.Entry<Collection<Player>, Collection<MapBoard>> getAllValues() {
|
||||||
Collection<Player> allPlayers = new ArrayList();
|
Collection<Player> allPlayers = new ArrayList();
|
||||||
ConcurrentMap<String, MapBoard> allMapBoards = new MapMaker().concurrencyLevel(4).makeMap();
|
ConcurrentMap<String, MapBoard> allMapBoards = new MapMaker().concurrencyLevel(4).makeMap();
|
||||||
String sqlQuery = "SELECT * FROM `zetimer_table`";
|
|
||||||
try (Connection con = DBCPDataSource.getConnection()) {
|
try (Connection con = DBCPDataSource.getConnection()) {
|
||||||
|
String sqlQuery_size = "SELECT count(*) FROM `zetimer_table_new`";
|
||||||
|
int rows_size = 0;
|
||||||
|
try (PreparedStatement ps = con.prepareStatement(sqlQuery_size)) {
|
||||||
|
try (ResultSet result = ps.executeQuery()) {
|
||||||
|
result.next();
|
||||||
|
rows_size = result.getInt(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//just a way to fetch 500 results at a time as seemingly struggling with just a select * from table statement.
|
||||||
|
String last_steam_auth = "";
|
||||||
|
while (allPlayers.size() < rows_size)
|
||||||
|
{
|
||||||
|
String sqlQuery = "select * from `zetimer_table_new` ztn where ztn.steam_auth > '" + last_steam_auth + "'\n" +
|
||||||
|
"order by steam_auth asc limit 5000 ";
|
||||||
|
if (allPlayers.size() == 0)
|
||||||
|
{
|
||||||
|
sqlQuery = "select * from `zetimer_table_new` ztn order by steam_auth asc limit 5000";
|
||||||
|
}
|
||||||
|
//System.out.println("sqlQuery: " + sqlQuery);
|
||||||
try (PreparedStatement ps = con.prepareStatement(sqlQuery)) {
|
try (PreparedStatement ps = con.prepareStatement(sqlQuery)) {
|
||||||
|
ps.setFetchSize(100);
|
||||||
|
//System.out.println("allplayers size: " + allPlayers.size() + " rows_size: " + rows_size);
|
||||||
try (ResultSet result = ps.executeQuery()) {
|
try (ResultSet result = ps.executeQuery()) {
|
||||||
int fetchSize = result.getMetaData().getColumnCount();
|
int fetchSize = result.getMetaData().getColumnCount();
|
||||||
while (result.next() /*&& limitfetch < 25*/) {
|
while (result.next() /*&& limitfetch < 25*/) {
|
||||||
@ -41,8 +61,8 @@ public class DataMapperCalls {
|
|||||||
//System.out.println("player dataMapper: " + player.getName() + "\nsteamid: " + player.getSteamID());
|
//System.out.println("player dataMapper: " + player.getName() + "\nsteamid: " + player.getSteamID());
|
||||||
int i = 3;
|
int i = 3;
|
||||||
while (i <= fetchSize) {
|
while (i <= fetchSize) {
|
||||||
String specificTime = result.getString(i);
|
Float specificTime = result.getFloat(i);
|
||||||
if (specificTime != null && !specificTime.equals("0.000")) {
|
if (specificTime != null && specificTime != 0) {
|
||||||
String columnLabel = result.getMetaData().getColumnLabel(i);
|
String columnLabel = result.getMetaData().getColumnLabel(i);
|
||||||
if (!allMapBoards.keySet().contains(columnLabel)) {
|
if (!allMapBoards.keySet().contains(columnLabel)) {
|
||||||
allMapBoards.put(columnLabel, new MapBoard(columnLabel));
|
allMapBoards.put(columnLabel, new MapBoard(columnLabel));
|
||||||
@ -57,6 +77,8 @@ public class DataMapperCalls {
|
|||||||
}
|
}
|
||||||
player.setTimesCount(timesCounter);
|
player.setTimesCount(timesCounter);
|
||||||
allPlayers.add(player);
|
allPlayers.add(player);
|
||||||
|
last_steam_auth = player.getSteamID();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class MapValues implements Serializable {
|
|||||||
private String playerSteamID;
|
private String playerSteamID;
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
private String time;
|
private Float time;
|
||||||
@Basic(optional = false)
|
@Basic(optional = false)
|
||||||
@NotNull
|
@NotNull
|
||||||
private int mapPoints;
|
private int mapPoints;
|
||||||
@ -75,11 +75,11 @@ public class MapValues implements Serializable {
|
|||||||
this.playerSteamID = steamID;
|
this.playerSteamID = steamID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTime() {
|
public Float getTime() {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(String specificTime) {
|
public void setTime(Float specificTime) {
|
||||||
this.time = specificTime;
|
this.time = specificTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,29 +398,12 @@ public class Facade {
|
|||||||
for (MapBoard mapboard : mapboards) {
|
for (MapBoard mapboard : mapboards) {
|
||||||
//System.out.println("mapName: " + mapboard.getMapName());
|
//System.out.println("mapName: " + mapboard.getMapName());
|
||||||
List<MapValues> mapvalues = new ArrayList();
|
List<MapValues> mapvalues = new ArrayList();
|
||||||
List<MapValues> less_than_a_minute = new ArrayList<>();
|
|
||||||
List<MapValues> less_than_10_seconds = new ArrayList<>();
|
|
||||||
for (MapValues mv : mapboard.getMapvalues())
|
for (MapValues mv : mapboard.getMapvalues())
|
||||||
{
|
{
|
||||||
String time = mv.getTime();
|
|
||||||
int indexOf = time.indexOf(".");
|
|
||||||
if (indexOf == 1){
|
|
||||||
less_than_10_seconds.add(mv);
|
|
||||||
}
|
|
||||||
else if (!time.contains(":"))
|
|
||||||
{
|
|
||||||
less_than_a_minute.add(mv);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
mapvalues.add(mv);
|
mapvalues.add(mv);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
less_than_10_seconds.sort(Comparator.comparing(MapValues::getTime));
|
|
||||||
mapvalues.sort(Comparator.comparing(MapValues::getTime));
|
mapvalues.sort(Comparator.comparing(MapValues::getTime));
|
||||||
less_than_a_minute.sort(Comparator.comparing(MapValues::getTime));
|
mapBoardCache.get(mapboard.getMapName()).setMapvalues(mapvalues);
|
||||||
less_than_10_seconds.addAll(less_than_a_minute);
|
|
||||||
less_than_10_seconds.addAll(mapvalues);
|
|
||||||
mapBoardCache.get(mapboard.getMapName()).setMapvalues(less_than_10_seconds);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user