fix: use new league endpoint by puuid

This commit is contained in:
Valentin Kaelin 2025-08-12 22:10:58 +02:00
parent f323395482
commit 9951048521
No known key found for this signature in database
GPG key ID: B389A4E3DFF8E414
5 changed files with 9 additions and 10 deletions

View file

@ -49,7 +49,7 @@ export default class SummonersController {
this.getSeasons(account.puuid),
MatchRepository.gamemodes(account.puuid),
Jax.Spectator.puuid(account.puuid, region),
SummonerService.getRanked(account.id, region),
SummonerService.getRanked(account.puuid, region),
MatchRepository.recentActivity(account.puuid),
// Only last 100 matchIds in matchlist
MatchService.updateMatchList(account.puuid, region, MatchListMode.LIGHT),

View file

@ -9,7 +9,7 @@ class MatchPlayerRankParser {
public async parse(match: Match): Promise<PlayerRankParsed[]> {
const requests = match.players
.filter((p) => p.summonerPuuid !== 'BOT')
.map((p) => SummonerService.getRanked(p.summonerId, match.region))
.map((p) => SummonerService.getRanked(p.summonerPuuid, match.region))
const ranks = await Promise.all(requests)
const parsedRanks = ranks

View file

@ -42,7 +42,7 @@ class LiveMatchSerializer extends MatchSerializer {
// Ranks
const requestsRanks = liveMatch.participants.map((p) =>
SummonerService.getRanked(p.summonerId, region)
SummonerService.getRanked(p.puuid, region)
)
const ranks = await Promise.all(requestsRanks)

View file

@ -8,8 +8,7 @@ export interface LeagueEntryDTO {
queueType: string
tier: string
rank: string
summonerId: string
summonerName: string
puuid: string
leaguePoints: number
wins: number
losses: number
@ -36,11 +35,11 @@ export default class LeagueEndpoint {
this.limiter = limiter
}
public summonerID(summonerID: string, region: string): Promise<LeagueEntryDTO[]> {
public puuid(puuid: string, region: string): Promise<LeagueEntryDTO[]> {
return new JaxRequest(
region,
this.config,
`league/v4/entries/by-summoner/${summonerID}`,
`league/v4/entries/by-puuid/${puuid}`,
this.limiter,
300
).execute()

View file

@ -100,11 +100,11 @@ class SummonerService {
/**
* Get ranked data for a specific Summoner
* @param account
* @param puuid
* @param region
*/
public async getRanked(summonerId: string, region: string): Promise<LeagueEntriesByQueue> {
const ranked = await Jax.League.summonerID(summonerId, region)
public async getRanked(puuid: string, region: string): Promise<LeagueEntriesByQueue> {
const ranked = await Jax.League.puuid(puuid, region)
const result: LeagueEntriesByQueue = {}
if (ranked && ranked.length) {