fix: check if roles needed in live game tab

This commit is contained in:
Valentin Kaelin 2020-06-17 21:22:23 +02:00
parent 30301e7cd2
commit 60cba28076

View file

@ -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') {