From ec47fe2372b50d40d9c4f1e10e4dc0adf0cbe66f Mon Sep 17 00:00:00 2001 From: Valentin Kaelin Date: Tue, 26 Nov 2019 18:39:22 +0100 Subject: [PATCH] fix: ally/enemy teams position in match details --- client/src/components/Match/DetailedMatch.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/components/Match/DetailedMatch.vue b/client/src/components/Match/DetailedMatch.vue index a3348fa..ac2408c 100644 --- a/client/src/components/Match/DetailedMatch.vue +++ b/client/src/components/Match/DetailedMatch.vue @@ -47,10 +47,16 @@ export default { computed: { allyTeam() { - return this.data.blueTeam.players.some(p => p.name.toLowerCase() === this.$route.params.name.toLowerCase()) ? this.data.blueTeam : this.data.redTeam + return this.data.blueTeam.players.some(p => this.compareSummonernames(p.name, this.$route.params.name)) ? this.data.blueTeam : this.data.redTeam }, enemyTeam() { - return this.data.blueTeam.players.some(p => p.name.toLowerCase() === this.$route.params.name.toLowerCase()) ? this.data.redTeam : this.data.blueTeam + return this.data.blueTeam.players.some(p => this.compareSummonernames(p.name, this.$route.params.name)) ? this.data.redTeam : this.data.blueTeam + } + }, + + methods: { + compareSummonernames(a, b) { + return a.toLowerCase().replace(/ /g, '') === b.toLowerCase().replace(/ /g, '') } } }