fix: custom games sometimes available in match-v5 endpoint

This commit is contained in:
Valentin Kaelin 2022-02-27 15:24:46 +01:00
parent 565682aff7
commit 0a563b52ec
3 changed files with 9 additions and 2 deletions

View file

@ -1,6 +1,10 @@
export const maps = { 10: 'The Twisted Treeline', 11: "Summoner's Rift", 12: 'Howling Abyss' } export const maps = { 10: 'The Twisted Treeline', 11: "Summoner's Rift", 12: 'Howling Abyss' }
export const gameModes = { export const gameModes = {
0: {
type: 'Custom',
name: 'Custom Game'
},
900: { 900: {
type: 'Normal', type: 'Normal',
name: 'URF', name: 'URF',

View file

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

View file

@ -136,7 +136,8 @@ class MatchService {
(m) => (m) =>
!tutorialQueues.includes(m.info.queueId) && !tutorialQueues.includes(m.info.queueId) &&
m.info.teams.length > 0 && m.info.teams.length > 0 &&
m.info.participants.length > 0 m.info.participants.length > 0 &&
m.info.gameMode !== 'PRACTICETOOL'
) )
// Transform raw matches data // Transform raw matches data