fix: remove bugged matches from Riot match-v5 too

This commit is contained in:
Kalane 2021-09-18 00:04:59 +02:00
parent f19efcbd19
commit 38439d8b9c

View file

@ -105,11 +105,19 @@ class MatchService {
/* If we have to store some matches in the db */
if (matchesFromApi.length !== 0) {
// Transform raw matches data
const parsedMatches: any = await MatchParser.parse(
matchesFromApi.filter(notEmpty).filter((m) => !tutorialQueues.includes(m.info.queueId))
// 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(filteredMatches)
// TODO: Serialize match from DB + put it in Redis + push it in "matches"
const serializedMatches = BasicMatchSerializer.serialize(parsedMatches, puuid, true)
matches.push(...serializedMatches)