Skip to content
Snippets Groups Projects
Commit 0d4d8884 authored by Jozef Bugos's avatar Jozef Bugos
Browse files

chaning api key

parent a765641d
No related branches found
No related tags found
No related merge requests found
Pipeline #31985 failed
......@@ -43,7 +43,7 @@ public class RiotController {
if(userId.equals("")) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null);
}
MatchesBean matches = riotService.getMatchHistory(server, userId, 5);
MatchesBean matches = riotService.getMatchHistory(server, userId, 3);
MatchStats[] matchStats = new MatchStats[matches.getMatches().length];
int i = 0;
for (MatchBean match : matches.getMatches()) {
......
......@@ -22,6 +22,8 @@ public class RiotService implements IRiotService {
@Autowired
private RestTemplate restTemplate;
static int counter = 0;
private final long MILISECONDS_IN_WEEK = 604800000;
private final long MILISECONDS_IN_THREE_MINUTES = 180000;
......@@ -31,6 +33,7 @@ public class RiotService implements IRiotService {
.queryParam("api_key", key)
.build().toUri();
log.info("Getting account id for username '" + username + "' on server " + server);
log.info("" + ++counter);
UserBean result = restTemplate.getForObject(uriAccount, UserBean.class);
return result.getAccountId();
}
......@@ -63,6 +66,7 @@ public class RiotService implements IRiotService {
+ (beginTime >= 0 ? " from week before " + timestamp : "")
);
try {
log.info("" + ++counter);
return restTemplate.getForObject(uriHistory, MatchesBean.class);
} catch (HttpClientErrorException ex) {
log.warn("No matches in week before " + timestamp + ". Returning empty list.");
......@@ -76,7 +80,7 @@ public class RiotService implements IRiotService {
.build().toUri();
log.info("Getting match detail for match with id '" + id + "' on server " + server);
log.info("" + ++counter);
return restTemplate.getForObject(uriHistory, MatchDetailBean.class);
}
......
......@@ -22,7 +22,7 @@ public class StatsService implements IStatsService {
+ " was played on time " + timestamp
);
MatchesBean matches = riotService.getMatchHistory(server, userId, 5, timestamp);
MatchesBean matches = riotService.getMatchHistory(server, userId, 1, timestamp);
int games = 0, wins = 0, streak = 0;
if (matches.getMatches() == null) {
log.warn("No matches found, returning empty statistics");
......@@ -61,7 +61,7 @@ public class StatsService implements IStatsService {
}
log.info(
"From last " + games + " game" + (games != 1 ? "s," : ",") + "player '" + summonerName
+ "' has " + wins + " win" + (wins != 1 ? "s" : "") + "and " + streak
+ "' has " + wins + " win" + (wins != 1 ? "s" : "") + " and " + streak
+ (isWinStreak ? " win" : " loose") + " streak"
);
return new StatsBean(summonerName, team, games, streak, isWinStreak, games > 0 ? wins / (double) games : 0);
......
API_KEY=RGAPI-190f673b-d809-4962-b912-1632fd481d3a
API_KEY=RGAPI-3a5704ba-22a3-4c04-942f-dd1ca1b43ba2
management.endpoints.jmx.exposure.exclude = info, health
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment