From 0a563b52ec16ef54d359f8f93efa778f49847157 Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Sun, 27 Feb 2022 15:24:46 +0100 Subject: [PATCH] fix: custom games sometimes available in match-v5 endpoint --- client/src/data/data.js | 4 ++++ server/app/Parsers/MatchPlayerRankParser.ts | 4 +++- server/app/Services/MatchService.ts | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/data/data.js b/client/src/data/data.js index 0316f9b..a68061f 100644 --- a/client/src/data/data.js +++ b/client/src/data/data.js @@ -1,6 +1,10 @@ export const maps = { 10: 'The Twisted Treeline', 11: "Summoner's Rift", 12: 'Howling Abyss' } export const gameModes = { + 0: { + type: 'Custom', + name: 'Custom Game' + }, 900: { type: 'Normal', name: 'URF', diff --git a/server/app/Parsers/MatchPlayerRankParser.ts b/server/app/Parsers/MatchPlayerRankParser.ts index 36d0a80..8a2115e 100644 --- a/server/app/Parsers/MatchPlayerRankParser.ts +++ b/server/app/Parsers/MatchPlayerRankParser.ts @@ -7,7 +7,9 @@ import { PlayerRankParsed } from './ParsedType' class MatchPlayerRankParser { public async parse(match: Match): Promise { - 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 parsedRanks = ranks diff --git a/server/app/Services/MatchService.ts b/server/app/Services/MatchService.ts index aaf80a0..c6c0e85 100644 --- a/server/app/Services/MatchService.ts +++ b/server/app/Services/MatchService.ts @@ -136,7 +136,8 @@ class MatchService { (m) => !tutorialQueues.includes(m.info.queueId) && m.info.teams.length > 0 && - m.info.participants.length > 0 + m.info.participants.length > 0 && + m.info.gameMode !== 'PRACTICETOOL' ) // Transform raw matches data