diff --git a/server/app/Controllers/Http/SummonerController.js b/server/app/Controllers/Http/SummonerController.js index cdb5324..9a49b6e 100644 --- a/server/app/Controllers/Http/SummonerController.js +++ b/server/app/Controllers/Http/SummonerController.js @@ -25,6 +25,7 @@ class SummonerController { const account = await Jax.Summoner.summonerName(summoner) // Check if the summoner is found if (!account) return response.json(null) + account.region = region finalJSON.account = account // RANKED STATS diff --git a/server/app/Helpers/MatchHelper.js b/server/app/Helpers/MatchHelper.js index ad8d9fc..b6b695b 100644 --- a/server/app/Helpers/MatchHelper.js +++ b/server/app/Helpers/MatchHelper.js @@ -21,9 +21,16 @@ class MatchHelper { let newMatchList = (await Jax.Matchlist.accountID(account.accountId, index)).matches matchList = [...matchList, ...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 } while (!alreadyIn); + // Remove matches from MatchList made in another region + matchList = matchList.filter(m => m.platformId.toLowerCase() === account.region) + return matchList } /** diff --git a/server/app/Transformers/MatchTransformer.js b/server/app/Transformers/MatchTransformer.js index f544c8d..52e6e08 100644 --- a/server/app/Transformers/MatchTransformer.js +++ b/server/app/Transformers/MatchTransformer.js @@ -57,7 +57,7 @@ class MatchTransformer extends BumblebeeTransformer { let primaryRune = null let secondaryRune = null - if(player.stats.perkPrimaryStyle) { + if (player.stats.perkPrimaryStyle) { const primaryRuneCategory = runes.find(r => r.id === player.stats.perkPrimaryStyle) for (const subCat of primaryRuneCategory.slots) { primaryRune = subCat.runes.find(r => r.id === player.stats.perk0)