mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
fix: remove games made in another region if player transfered
This commit is contained in:
parent
65185157a9
commit
18ccfeb21c
3 changed files with 9 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ class SummonerController {
|
||||||
const account = await Jax.Summoner.summonerName(summoner)
|
const account = await Jax.Summoner.summonerName(summoner)
|
||||||
// Check if the summoner is found
|
// Check if the summoner is found
|
||||||
if (!account) return response.json(null)
|
if (!account) return response.json(null)
|
||||||
|
account.region = region
|
||||||
finalJSON.account = account
|
finalJSON.account = account
|
||||||
|
|
||||||
// RANKED STATS
|
// RANKED STATS
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,16 @@ class MatchHelper {
|
||||||
let newMatchList = (await Jax.Matchlist.accountID(account.accountId, index)).matches
|
let newMatchList = (await Jax.Matchlist.accountID(account.accountId, index)).matches
|
||||||
matchList = [...matchList, ...newMatchList]
|
matchList = [...matchList, ...newMatchList]
|
||||||
alreadyIn = stopFetching(newMatchList)
|
alreadyIn = stopFetching(newMatchList)
|
||||||
|
// If the match is made in another region : we stop fetching
|
||||||
|
if (matchList[matchList.length - 1].platformId.toLowerCase() !== account.region) {
|
||||||
|
alreadyIn = true;
|
||||||
|
}
|
||||||
index += 100
|
index += 100
|
||||||
} while (!alreadyIn);
|
} while (!alreadyIn);
|
||||||
|
|
||||||
|
// Remove matches from MatchList made in another region
|
||||||
|
matchList = matchList.filter(m => m.platformId.toLowerCase() === account.region)
|
||||||
|
|
||||||
return matchList
|
return matchList
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue