From e73b231db2065e59cd231dc99e47e1a19d3f7955 Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Tue, 29 Sep 2020 18:02:44 +0200 Subject: [PATCH] fix(role-identification): better fix to remove duplicate --- server/app/Services/RoleIdentificationService.js | 2 +- server/app/Transformers/MatchTransformer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/app/Services/RoleIdentificationService.js b/server/app/Services/RoleIdentificationService.js index 4cac7c6..9c30464 100644 --- a/server/app/Services/RoleIdentificationService.js +++ b/server/app/Services/RoleIdentificationService.js @@ -197,7 +197,7 @@ class RoleIdentificationService { // Done! Grab the results. const positionsWithMetric = {} for (const [position, champion] of Object.entries(positions)) { - if (Object.keys(identified).includes(position)) { + if (Object.keys(identified).includes(position) || champion === jungle || champion === support) { continue } positionsWithMetric[position] = { diff --git a/server/app/Transformers/MatchTransformer.js b/server/app/Transformers/MatchTransformer.js index d901220..c63fb9a 100644 --- a/server/app/Transformers/MatchTransformer.js +++ b/server/app/Transformers/MatchTransformer.js @@ -212,7 +212,7 @@ class MatchTransformer { const teamSupports = team.filter(p => p.support && !p.jungle) const support = teamSupports.length === 1 ? teamSupports[0].champion : null - return RoleIdentificationService.getRoles(this.championRoles, team.map(p => p.champion), null, support) + return RoleIdentificationService.getRoles(this.championRoles, team.map(p => p.champion), jungle, support) } /**