From 38439d8b9cc5d0d298e1dbed8b00878c77658694 Mon Sep 17 00:00:00 2001 From: Kalane Date: Sat, 18 Sep 2021 00:04:59 +0200 Subject: [PATCH] fix: remove bugged matches from Riot match-v5 too --- server-v2/app/Services/MatchService.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server-v2/app/Services/MatchService.ts b/server-v2/app/Services/MatchService.ts index 6174495..3d48ece 100644 --- a/server-v2/app/Services/MatchService.ts +++ b/server-v2/app/Services/MatchService.ts @@ -105,10 +105,18 @@ class MatchService { /* If we have to store some matches in the db */ if (matchesFromApi.length !== 0) { + // Remove bugged matches from the Riot API + tutorial games + const filteredMatches = matchesFromApi + .filter(notEmpty) + .filter( + (m) => + !tutorialQueues.includes(m.info.queueId) && + m.info.teams.length > 0 && + m.info.participants.length > 0 + ) + // Transform raw matches data - const parsedMatches: any = await MatchParser.parse( - matchesFromApi.filter(notEmpty).filter((m) => !tutorialQueues.includes(m.info.queueId)) - ) + const parsedMatches: any = await MatchParser.parse(filteredMatches) // TODO: Serialize match from DB + put it in Redis + push it in "matches" const serializedMatches = BasicMatchSerializer.serialize(parsedMatches, puuid, true)