just some more updates
This commit is contained in:
parent
01405d0532
commit
cf49e6546d
@ -20,6 +20,70 @@ public class PlayerDTO {
|
|||||||
private String steamID64;
|
private String steamID64;
|
||||||
private String steamID;
|
private String steamID;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
public String getSteamID64() {
|
||||||
|
return steamID64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSteamID64(String steamID64) {
|
||||||
|
this.steamID64 = steamID64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSteamID() {
|
||||||
|
return steamID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSteamID(String steamID) {
|
||||||
|
this.steamID = steamID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAvatar() {
|
||||||
|
return Avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvatar(String Avatar) {
|
||||||
|
this.Avatar = Avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRank() {
|
||||||
|
return Rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRank(int Rank) {
|
||||||
|
this.Rank = Rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPlayerPoints() {
|
||||||
|
return PlayerPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayerPoints(int PlayerPoints) {
|
||||||
|
this.PlayerPoints = PlayerPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTimes() {
|
||||||
|
return Times;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimes(int Times) {
|
||||||
|
this.Times = Times;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getUrlBanners() {
|
||||||
|
return UrlBanners;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrlBanners(List<String> UrlBanners) {
|
||||||
|
this.UrlBanners = UrlBanners;
|
||||||
|
}
|
||||||
private String Avatar;
|
private String Avatar;
|
||||||
private int Rank;
|
private int Rank;
|
||||||
private int PlayerPoints;
|
private int PlayerPoints;
|
||||||
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -46,12 +47,11 @@ import utils.PuSelector;
|
|||||||
|
|
||||||
public class Facade {
|
public class Facade {
|
||||||
|
|
||||||
private ConcurrentMap<String, Player> playerCache = new MapMaker().concurrencyLevel(4).makeMap();
|
private static Map<String, Player> playerCache = new LinkedHashMap();
|
||||||
private ConcurrentMap<String, MapBoard> mapBoardCache = new MapMaker().concurrencyLevel(4).makeMap();
|
private static ConcurrentMap<String, MapBoard> mapBoardCache = new MapMaker().concurrencyLevel(4).makeMap();
|
||||||
private ConcurrentMap<String, ConcurrentMap<String, MapValues>> playerRelatedMapValuesCache = new MapMaker().concurrencyLevel(6).makeMap();
|
private static ConcurrentMap<String, ConcurrentMap<String, MapValues>> playerRelatedMapValuesCache = new MapMaker().concurrencyLevel(6).makeMap();
|
||||||
private final long EXPIRE_TIME_IN_SECONDS = TimeUnit.SECONDS.convert(30, TimeUnit.MINUTES);
|
private static final long EXPIRE_TIME_IN_SECONDS = TimeUnit.SECONDS.convert(30, TimeUnit.MINUTES);
|
||||||
private Instant elapsedTime;
|
private static Instant elapsedTime = Instant.now();
|
||||||
private int initSetup = 0;
|
|
||||||
private static final ForkJoinPool executor = instantiateExecutor();
|
private static final ForkJoinPool executor = instantiateExecutor();
|
||||||
|
|
||||||
private static ForkJoinPool instantiateExecutor() {
|
private static ForkJoinPool instantiateExecutor() {
|
||||||
@ -60,11 +60,6 @@ public class Facade {
|
|||||||
null, false);
|
null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Facade() {
|
|
||||||
elapsedTime = Instant.now();
|
|
||||||
initSetup = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean getMap(String map, String Identifier) {
|
private boolean getMap(String map, String Identifier) {
|
||||||
boolean identified = Pattern.compile(Pattern.quote(Identifier), Pattern.CASE_INSENSITIVE).matcher(map).find();
|
boolean identified = Pattern.compile(Pattern.quote(Identifier), Pattern.CASE_INSENSITIVE).matcher(map).find();
|
||||||
return identified;
|
return identified;
|
||||||
@ -236,24 +231,24 @@ public class Facade {
|
|||||||
public Collection<PlayerDTO> getleaderBoard(int iterator) {
|
public Collection<PlayerDTO> getleaderBoard(int iterator) {
|
||||||
int playerAddiditionCap = 99;
|
int playerAddiditionCap = 99;
|
||||||
Collection<Player> playerAvatarsCaching = new ArrayList();
|
Collection<Player> playerAvatarsCaching = new ArrayList();
|
||||||
List<Player> players = new ArrayList(playerCache.values());
|
|
||||||
Collection<PlayerDTO> playersDTO = new ArrayList();
|
Collection<PlayerDTO> playersDTO = new ArrayList();
|
||||||
players.sort(Comparator.comparing(Player::getRank));
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (Player player : players) {
|
for (Player player : playerCache.values()) {
|
||||||
if (counter >= iterator && counter <= iterator + playerAddiditionCap && player.getAvatar() == null) {
|
if (counter >= iterator && counter <= iterator + playerAddiditionCap) {
|
||||||
|
if (player.getAvatar() == null || player.getAvatar().isEmpty()) {
|
||||||
playerAvatarsCaching.add(player);
|
playerAvatarsCaching.add(player);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (counter > iterator + playerAddiditionCap) {
|
if (counter > iterator + playerAddiditionCap) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
if (!playerAvatarsCaching.isEmpty()) {
|
||||||
updateAvatarsToCache(playerAvatarsCaching);
|
updateAvatarsToCache(playerAvatarsCaching);
|
||||||
players = new ArrayList(playerCache.values());
|
}
|
||||||
players.sort(Comparator.comparing(Player::getRank));
|
|
||||||
counter = 0;
|
counter = 0;
|
||||||
for (Player player : players) {
|
for (Player player : playerCache.values()) {
|
||||||
if (counter >= iterator && counter <= iterator + playerAddiditionCap) {
|
if (counter >= iterator && counter <= iterator + playerAddiditionCap) {
|
||||||
playersDTO.add(new PlayerDTO(player));
|
playersDTO.add(new PlayerDTO(player));
|
||||||
}
|
}
|
||||||
@ -265,9 +260,10 @@ public class Facade {
|
|||||||
return playersDTO;
|
return playersDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addNewPlayerValuesToCache(Collection<Player> keyCollection, ConcurrentMap<String, Collection<Integer>> playerUrlBanners) {
|
private ConcurrentMap<String, Player> addNewPlayerValuesToCache(Collection<Player> keyCollection, ConcurrentMap<String, Collection<Integer>> playerUrlBanners) {
|
||||||
//2 = user, 6 = mapper, 7 = admin, 8 = technical staff, 10 = leader, 12 = vip, 13 = trial admin, 15 = event winner, 19 = discord manager
|
//2 = user, 6 = mapper, 7 = admin, 8 = technical staff, 10 = leader, 12 = vip, 13 = trial admin, 15 = event winner, 19 = discord manager
|
||||||
// 20 NSFW, 21 = Retired admin, 25 = event manager, 11 = GA
|
// 20 NSFW, 21 = Retired admin, 25 = event manager, 11 = GA
|
||||||
|
ConcurrentMap<String, Player> playersConcurrentMap = new MapMaker().concurrencyLevel(6).makeMap();
|
||||||
for (Player player : keyCollection) {
|
for (Player player : keyCollection) {
|
||||||
Collection<Integer> banners = playerUrlBanners.getOrDefault(player.getSteamID(), null);
|
Collection<Integer> banners = playerUrlBanners.getOrDefault(player.getSteamID(), null);
|
||||||
if (banners != null) {
|
if (banners != null) {
|
||||||
@ -319,8 +315,9 @@ public class Facade {
|
|||||||
}
|
}
|
||||||
player.setUrlBanners(urlBanners);
|
player.setUrlBanners(urlBanners);
|
||||||
}
|
}
|
||||||
playerCache.put(player.getSteamID(), player);
|
playersConcurrentMap.put(player.getSteamID(), player);
|
||||||
}
|
}
|
||||||
|
return playersConcurrentMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void retrieveAvatarFull(String avatarurl) {
|
private void retrieveAvatarFull(String avatarurl) {
|
||||||
@ -333,12 +330,17 @@ public class Facade {
|
|||||||
JSONObject jsonObject = root.getJSONObject("response");
|
JSONObject jsonObject = root.getJSONObject("response");
|
||||||
JSONArray jsonArray = jsonObject.getJSONArray("players");
|
JSONArray jsonArray = jsonObject.getJSONArray("players");
|
||||||
for (int incrementer = 0; incrementer < jsonArray.length(); incrementer++) {
|
for (int incrementer = 0; incrementer < jsonArray.length(); incrementer++) {
|
||||||
worker = new CallableJsonObject(jsonArray.getJSONObject(incrementer));
|
JSONObject jsonObjectPlayer = jsonArray.getJSONObject(incrementer);
|
||||||
futures.put(incrementer, executor.submit(worker));
|
|
||||||
}
|
|
||||||
futures.values().parallelStream().forEach(future -> {
|
|
||||||
try {
|
try {
|
||||||
Entry<String, String> getEntry = future.get(3, TimeUnit.SECONDS);
|
worker = new CallableJsonObject(jsonObjectPlayer);
|
||||||
|
futures.put(incrementer, executor.submit(worker));
|
||||||
|
} catch (Exception ex) {
|
||||||
|
//some are simply nosteamers with no steam data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
futures.values().forEach(future -> {
|
||||||
|
try {
|
||||||
|
Entry<String, String> getEntry = future.get(5, TimeUnit.SECONDS);
|
||||||
playerCache.get(getEntry.getKey()).setAvatar(getEntry.getValue());
|
playerCache.get(getEntry.getKey()).setAvatar(getEntry.getValue());
|
||||||
} catch (InterruptedException | ExecutionException | TimeoutException ex) {
|
} catch (InterruptedException | ExecutionException | TimeoutException ex) {
|
||||||
Logger.getLogger(Facade.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Facade.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
@ -355,37 +357,15 @@ public class Facade {
|
|||||||
//http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=262F3F0C6B83E0F263C272C3762002F1&steamids=76561198029832363,76561198003907342
|
//http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=262F3F0C6B83E0F263C272C3762002F1&steamids=76561198029832363,76561198003907342
|
||||||
StringBuilder avatarURL = new StringBuilder();
|
StringBuilder avatarURL = new StringBuilder();
|
||||||
avatarURL.append("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=262F3F0C6B83E0F263C272C3762002F1&steamids=");
|
avatarURL.append("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=262F3F0C6B83E0F263C272C3762002F1&steamids=");
|
||||||
int incrementer = 0;
|
boolean init = true;
|
||||||
int overallCounter = 0;
|
|
||||||
int fetchCapacity = players.size() > 5 ? players.size() / 5 : 6;
|
|
||||||
CountDownLatch cdl = new CountDownLatch(1);
|
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
if (incrementer > 0) {
|
if (!init) {
|
||||||
avatarURL.append(",");
|
avatarURL.append(",");
|
||||||
}
|
}
|
||||||
incrementer++;
|
|
||||||
avatarURL.append(Long.toString(convertSteamIdToCommunityId(player.getSteamID())));
|
avatarURL.append(Long.toString(convertSteamIdToCommunityId(player.getSteamID())));
|
||||||
if (incrementer >= fetchCapacity || incrementer + overallCounter >= players.size()) {
|
init = false;
|
||||||
final String fullUrl = avatarURL.toString();
|
|
||||||
final int overall = incrementer + overallCounter;
|
|
||||||
new Thread(() -> {
|
|
||||||
retrieveAvatarFull(fullUrl);
|
|
||||||
if (overall >= players.size()) {
|
|
||||||
cdl.countDown();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
overallCounter += incrementer;
|
|
||||||
incrementer = 0;
|
|
||||||
avatarURL = new StringBuilder();
|
|
||||||
avatarURL.append("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=262F3F0C6B83E0F263C272C3762002F1&steamids=");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
cdl.await();
|
|
||||||
} catch (InterruptedException ex) {
|
|
||||||
System.out.println("cdl await interrupted: " + ex.getLocalizedMessage() + "\n");
|
|
||||||
}
|
}
|
||||||
|
retrieveAvatarFull(avatarURL.toString());
|
||||||
setNonExistingAvatarOnPlayers(players);
|
setNonExistingAvatarOnPlayers(players);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,23 +419,24 @@ public class Facade {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPlayerPoints() {
|
private List<Player> setPlayerPoints(ConcurrentMap<String, Player> playersMap) {
|
||||||
for (MapBoard mapboard : mapBoardCache.values()) {
|
for (MapBoard mapboard : mapBoardCache.values()) {
|
||||||
List<MapValues> mapvalues = mapboard.getMapvalues();
|
List<MapValues> mapvalues = mapboard.getMapvalues();
|
||||||
for (MapValues mapvalue : mapvalues) {
|
for (MapValues mapvalue : mapvalues) {
|
||||||
String steamID = mapvalue.getPlayerSteamID();
|
String steamID = mapvalue.getPlayerSteamID();
|
||||||
int mapPoints = mapvalue.getMapPoints();
|
int mapPoints = mapvalue.getMapPoints();
|
||||||
playerCache.get(steamID).addPlayerPoints(mapPoints);
|
playersMap.get(steamID).addPlayerPoints(mapPoints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return new ArrayList(playersMap.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePlayerRanks() {
|
private void updatePlayerRanks(List<Player> playersConcurrentmap) {
|
||||||
List<Player> playerList = new ArrayList(playerCache.values());
|
|
||||||
playerList.sort(Comparator.comparing(Player::getPlayerPoints).reversed());
|
|
||||||
int rank = 1;
|
int rank = 1;
|
||||||
for (Player player : playerList) {
|
playersConcurrentmap.sort(Comparator.comparing(Player::getPlayerPoints).reversed());
|
||||||
playerCache.get(player.getSteamID()).setRank(rank);
|
for (Player player : playersConcurrentmap) {
|
||||||
|
player.setRank(rank);
|
||||||
|
playerCache.put(player.getSteamID(), player);
|
||||||
rank++;
|
rank++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -478,13 +459,12 @@ public class Facade {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkTimeElapse() {
|
public String checkTimeElapse() {
|
||||||
Instant current = Instant.now();
|
Instant current = Instant.now();
|
||||||
long timeElapsed = Duration.between(elapsedTime, current).toMillis();
|
long timeElapsed = Duration.between(elapsedTime, current).toMillis();
|
||||||
//perharps 3 mins instead of 30?
|
int cachesize = playerCache.size();
|
||||||
if (timeElapsed >= EXPIRE_TIME_IN_SECONDS * 1000 || initSetup > 0) {
|
if (timeElapsed >= EXPIRE_TIME_IN_SECONDS * 1000 || playerCache.isEmpty()) {
|
||||||
//System.out.println("went through \ntimeElapsed: " + timeElapsed + "\nEXPIRE_TIME_IN_SECONDS: " + EXPIRE_TIME_IN_SECONDS * 100);
|
String elapsed = String.valueOf(timeElapsed);
|
||||||
initSetup = 0;
|
|
||||||
elapsedTime = Instant.now();
|
elapsedTime = Instant.now();
|
||||||
Entry<Collection<Player>, Collection<MapBoard>> playersMapBoards = DataMapperCalls.getAllValues();
|
Entry<Collection<Player>, Collection<MapBoard>> playersMapBoards = DataMapperCalls.getAllValues();
|
||||||
Collection<MapBoard> mapBoardCollection = playersMapBoards.getValue();
|
Collection<MapBoard> mapBoardCollection = playersMapBoards.getValue();
|
||||||
@ -493,14 +473,16 @@ public class Facade {
|
|||||||
mapBoardCache.clear();
|
mapBoardCache.clear();
|
||||||
playerRelatedMapValuesCache.clear();
|
playerRelatedMapValuesCache.clear();
|
||||||
addNewMapBoardValuesToCache(mapBoardCollection);
|
addNewMapBoardValuesToCache(mapBoardCollection);
|
||||||
addNewPlayerValuesToCache(playersMapBoards.getKey(), playerRelatedUrlBanners);
|
ConcurrentMap<String, Player> playersConcurrentmap = addNewPlayerValuesToCache(playersMapBoards.getKey(), playerRelatedUrlBanners);
|
||||||
orderingMapBoardValuesByTime();
|
orderingMapBoardValuesByTime();
|
||||||
setPositionAndMapPoints();
|
setPositionAndMapPoints();
|
||||||
setPlayerPoints();
|
updatePlayerRanks(setPlayerPoints(playersConcurrentmap));
|
||||||
updatePlayerRanks();
|
|
||||||
setTimesAsociatedToPeople();
|
setTimesAsociatedToPeople();
|
||||||
//updateEntitiesPersistence();
|
//updateEntitiesPersistence();
|
||||||
|
//System.out.println("timeElapsed: " + elapsed + "\nEXPIRE_TIME_IN_SECONDS: " + EXPIRE_TIME_IN_SECONDS * 1000 + "cachesize: " + cachesize);
|
||||||
|
//return "timeElapsed: " + elapsed + "\nEXPIRE_TIME_IN_SECONDS: " + EXPIRE_TIME_IN_SECONDS * 1000 + "cachesize: " + cachesize;
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEntitiesPersistence() {
|
public void updateEntitiesPersistence() {
|
||||||
|
@ -28,12 +28,15 @@ public class Initialization {
|
|||||||
Facade facade = new Facade();
|
Facade facade = new Facade();
|
||||||
|
|
||||||
facade.checkTimeElapse();
|
facade.checkTimeElapse();
|
||||||
|
System.out.println("finished first timeelapse");
|
||||||
List<Player> getAllPlayers = facade.getAllPlayersFromCache();
|
List<Player> getAllPlayers = facade.getAllPlayersFromCache();
|
||||||
|
System.out.println("finished getAllPlayers");
|
||||||
facade.getleaderBoard(0);
|
facade.getleaderBoard(0);
|
||||||
|
System.out.println("finished retrieving leaderboard");
|
||||||
Collection<MapBoard> getAllMapBoards = facade.getAllMapBoardsFromCache();
|
Collection<MapBoard> getAllMapBoards = facade.getAllMapBoardsFromCache();
|
||||||
|
|
||||||
//facade.getPlayerMaps("STEAM_0:0:33155716", 0);
|
//facade.getPlayerMaps("STEAM_0:0:33155716", 0);
|
||||||
|
/*
|
||||||
AdminEditor admin = new AdminEditor("jenz", "1234");
|
AdminEditor admin = new AdminEditor("jenz", "1234");
|
||||||
EntityManager em = PuSelector.getEntityManagerFactory("pu").createEntityManager();
|
EntityManager em = PuSelector.getEntityManagerFactory("pu").createEntityManager();
|
||||||
//simply cant persist collections/list
|
//simply cant persist collections/list
|
||||||
@ -53,5 +56,9 @@ public class Initialization {
|
|||||||
}
|
}
|
||||||
em.persist(admin);
|
em.persist(admin);
|
||||||
em.getTransaction().commit();
|
em.getTransaction().commit();
|
||||||
|
*/
|
||||||
|
System.out.println("checktime second time");
|
||||||
|
facade.checkTimeElapse();
|
||||||
|
facade.getSpecificMap("ze_Ancient_wrath_v1_fix2", 1, 153);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { trackPromise } from 'react-promise-tracker';
|
import { trackPromise } from 'react-promise-tracker';
|
||||||
const URLleaderboard = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/leaderboard";
|
const URLleaderboard = "http://163.172.84.14:8080/racetimer_endpoints-1.0/api/timers/leaderboard";
|
||||||
const URLPlayer = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/player/";
|
const URLPlayer = "http://163.172.84.14:8080/racetimer_endpoints-1.0/api/timers/player/";
|
||||||
const URLPlayerMaps = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/player/maps/";
|
const URLPlayerMaps = "http://163.172.84.14:8080/racetimer_endpoints-1.0/api/timers/player/maps/";
|
||||||
const URLMaps = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/map/";
|
const URLMaps = "http://163.172.84.14:8080/racetimer_endpoints-1.0/api/timers/map/";
|
||||||
const URLAllMaps = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/allmaps";
|
const URLAllMaps = "http://163.172.84.14:8080/racetimer_endpoints-1.0/api/timers/allmaps";
|
||||||
const URLMapsSize = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/mapsizecache";
|
const URLMapsSize = "http://163.172.84.14:8080/racetimer_endpoints-1.0/api/timers/mapsizecache";
|
||||||
const URLSearchPlayers = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/searchplayers/";
|
const URLSearchPlayers = "http://163.172.84.14:8080/racetimer_endpoints-1.0/api/timers/searchplayers/";
|
||||||
const URLSearchMaps = "http://localhost:8080/racetimer_endpoints-1.0/api/timers/searchmaps/";
|
const URLSearchMaps = "http://163.172.84.14:8080/racetimer_endpoints-1.0/api/timers/searchmaps/";
|
||||||
|
|
||||||
function handleHttpErrors(res) {
|
function handleHttpErrors(res) {
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
|
@ -128,7 +128,7 @@ class Leaderboard extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{!this.state.breakload ? <h1>
|
{!this.state.breakload ? <h1>
|
||||||
Loading Maps <br /> <br /> <br /> <LoadingIndicator />
|
Loading Players <br /> <br /> <br /> <LoadingIndicator />
|
||||||
</h1> : ""}
|
</h1> : ""}
|
||||||
{this.state.searchBool ? ("") : (<PlayersSearch keyword={this.state.keyword} />)}
|
{this.state.searchBool ? ("") : (<PlayersSearch keyword={this.state.keyword} />)}
|
||||||
<div className="container mm">
|
<div className="container mm">
|
||||||
|
@ -52,13 +52,13 @@ class Maps extends React.Component {
|
|||||||
window.removeEventListener("scroll", this.scrollListener);
|
window.removeEventListener("scroll", this.scrollListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
findSecondLast(array) {
|
findLateIndex(array) {
|
||||||
return array[array.length - 2];
|
return array[array.length - 5];
|
||||||
}
|
}
|
||||||
|
|
||||||
handleScroll = () => {
|
handleScroll = () => {
|
||||||
if (this.state.breakload && this.state.fetchsize > this.state.mapTimes.length) {
|
if (this.state.breakload && this.state.fetchsize > this.state.mapTimes.length) {
|
||||||
const player = this.findSecondLast(this.state.mapTimes);
|
const player = this.findLateIndex(this.state.mapTimes);
|
||||||
var lastLi = document.getElementById('maps/' + player.steamID);
|
var lastLi = document.getElementById('maps/' + player.steamID);
|
||||||
var lastLiOffset = lastLi.offsetTop + lastLi.clientHeight;
|
var lastLiOffset = lastLi.offsetTop + lastLi.clientHeight;
|
||||||
var pageOffset = window.pageYOffset + window.innerHeight;
|
var pageOffset = window.pageYOffset + window.innerHeight;
|
||||||
@ -99,7 +99,7 @@ class Maps extends React.Component {
|
|||||||
</p>
|
</p>
|
||||||
<p className="text-center ">
|
<p className="text-center ">
|
||||||
<NavLink to={'/leaderboard/'}>
|
<NavLink to={'/leaderboard/'}>
|
||||||
<b>leaderboard</b>
|
<b>LeaderBoard</b>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -100,7 +100,7 @@ class Player extends React.Component {
|
|||||||
</p>
|
</p>
|
||||||
<p className="text-center ">
|
<p className="text-center ">
|
||||||
<NavLink to={'/leaderboard/'}>
|
<NavLink to={'/leaderboard/'}>
|
||||||
<b>leaderboard</b>
|
<b>LeaderBoard</b>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user