diff --git a/server/app/Controllers/Http/MatchesController.ts b/server/app/Controllers/Http/MatchesController.ts index d9c4a08..efd8e62 100644 --- a/server/app/Controllers/Http/MatchesController.ts +++ b/server/app/Controllers/Http/MatchesController.ts @@ -18,7 +18,7 @@ export default class MatchesController { * @param region of the match */ private async getPlayerRank (summoner: ParticipantDetails, region: string) { - const account = await SummonerService.getAccount(summoner.name, region) + const account = await Jax.Summoner.summonerId(summoner.summonerId, region) if (account) { const ranked = await SummonerService.getRanked(account, region) summoner.rank = ranked.soloQ ? (({ tier, shortName }) => ({ tier, shortName }))(ranked.soloQ) : null diff --git a/server/app/Services/Jax/src/Endpoints/SummonerEndpoint.ts b/server/app/Services/Jax/src/Endpoints/SummonerEndpoint.ts index 6c24120..9083511 100644 --- a/server/app/Services/Jax/src/Endpoints/SummonerEndpoint.ts +++ b/server/app/Services/Jax/src/Endpoints/SummonerEndpoint.ts @@ -23,6 +23,16 @@ export default class SummonerEndpoint { this.limiter = limiter } + public summonerId (summonerId: string, region: string): Promise { + return new JaxRequest( + region, + this.config, + `summoner/v4/summoners/${summonerId}`, + this.limiter, + 36000 + ).execute() + } + public summonerName (summonerName: string, region: string): Promise { return new JaxRequest( region, diff --git a/server/app/Transformers/LiveMatchTransformer.ts b/server/app/Transformers/LiveMatchTransformer.ts index 9d4018f..74003a7 100644 --- a/server/app/Transformers/LiveMatchTransformer.ts +++ b/server/app/Transformers/LiveMatchTransformer.ts @@ -1,4 +1,5 @@ import { queuesWithRole } from 'App/helpers' +import Jax from 'App/Services/Jax' import { CurrentGameInfo, CurrentGameParticipant } from 'App/Services/Jax/src/Endpoints/SpectatorEndpoint' import { FinalRoleComposition } from 'App/Services/RoleIdentiticationService' import SummonerService, { LeagueEntriesByQueue } from 'App/Services/SummonerService' @@ -11,7 +12,7 @@ class LiveMatchTransformer extends MatchTransformer { * @param region */ private async getPlayerRank (participant: CurrentGameParticipant, region: string) { - const account = await SummonerService.getAccount(participant.summonerName, region) + const account = await Jax.Summoner.summonerId(participant.summonerId, region) let ranked: LeagueEntriesByQueue if (account) { ranked = await SummonerService.getRanked(account, region)