This commit is contained in:
Valentin Kaelin 2021-09-28 11:15:35 +02:00
commit 398ecfe7ae
3 changed files with 11 additions and 1 deletions

View file

@ -42,12 +42,16 @@ export default class SummonersController {
finalJSON.seasons = [getCurrentSeason()]
// CURRENT GAME
console.time('playing')
const currentGame = await Jax.Spectator.summonerID(account.id, region)
finalJSON.playing = !!currentGame
finalJSON.current = currentGame
console.timeEnd('playing')
// RANKED STATS
console.time('ranked')
finalJSON.ranked = await SummonerService.getRanked(account.id, region)
console.timeEnd('ranked')
// RECENT ACTIVITY
finalJSON.recentActivity = await StatsService.getRecentActivity(account.puuid)

View file

@ -21,6 +21,7 @@ class MatchService {
let alreadyIn = false
let index = 0
do {
console.log('--> CALL TO RIOT MATCHLIST')
const newMatchList = await Jax.Matchlist.puuid(account.puuid, region, index)
// Error while fetching Riot API
if (!newMatchList) {
@ -49,6 +50,7 @@ class MatchService {
const currentMatchList = await summonerDB.related('matchList').query().orderBy('matchId', 'asc')
const currentMatchListIds = currentMatchList.map((m) => m.matchId)
console.time('RiotMatchList')
const newMatchList = await this._fetchMatchListUntil(
account,
region,
@ -56,6 +58,7 @@ class MatchService {
return currentMatchListIds.some((id) => id === newMatchList[newMatchList.length - 1])
}
)
console.timeEnd('RiotMatchList')
const matchListToSave: MatchlistDto = []
for (const matchId of newMatchList.reverse()) {

View file

@ -5,7 +5,10 @@ import BasicMatchSerializer from 'App/Serializers/BasicMatchSerializer'
class StatsService {
public async getRecentActivity(puuid: string) {
return MatchRepository.recentActivity(puuid)
console.time('RecentActivity')
const recentActivity = await MatchRepository.recentActivity(puuid)
console.timeEnd('RecentActivity')
return recentActivity
}
public async getSummonerStats(puuid: string, season?: number) {
console.time('GLOBAL')