From 60cba280764d525622f6fedb3fbe210bf84bc34a Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Wed, 17 Jun 2020 21:22:23 +0200 Subject: [PATCH] fix: check if roles needed in live game tab --- server/app/Transformers/LiveMatchTransformer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/app/Transformers/LiveMatchTransformer.js b/server/app/Transformers/LiveMatchTransformer.js index 02ff616..7c13731 100644 --- a/server/app/Transformers/LiveMatchTransformer.js +++ b/server/app/Transformers/LiveMatchTransformer.js @@ -43,7 +43,8 @@ class LiveMatchTransformer extends MatchTransformer { const redTeam = [] // 200 let blueRoles = [] let redRoles = [] - if (this.championRoles && queuesWithRole.includes(match.gameQueueConfigId)) { + const needsRole = this.championRoles && queuesWithRole.includes(match.gameQueueConfigId) + if (needsRole) { match.participants.map(p => { const playerRole = { champion: p.championId, jungle: p.spell1Id === 11 || p.spell2Id === 11 } p.teamId === 100 ? blueTeam.push(playerRole) : redTeam.push(playerRole) @@ -58,7 +59,7 @@ class LiveMatchTransformer extends MatchTransformer { participant.runes = participant.perks ? super.getPerksImages(participant.perks.perkIds[0], participant.perks.perkSubStyle) : {} // Roles - if (this.championRoles) { + if (needsRole) { const roles = participant.teamId === 100 ? blueRoles : redRoles participant.role = Object.entries(roles).find(([, champion]) => participant.championId === champion)[0] if (participant.role === 'UTILITY') {