From 994d381661082abcca582971602dfe05ee1cdb93 Mon Sep 17 00:00:00 2001 From: schneefux Date: Thu, 19 Jul 2018 11:17:08 +0200 Subject: HeroTalentTable: Show hero average win rate --- src/HeroTalentTable.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/HeroTalentTable.vue b/src/HeroTalentTable.vue index d49ff19..ec0a7be 100644 --- a/src/HeroTalentTable.vue +++ b/src/HeroTalentTable.vue @@ -4,8 +4,8 @@
-
{{ (100 * heroReport[0].Winner).toFixed(0) }}% Win Rate
-
{{ (100 * totalHeroPicks / totalPicks * playersPerMatch).toFixed(0) }}% Pick Rate
+
{{ (100 * totalHeroReport.Winner / totalHeroReport.Count).toFixed(0) }}% Win Rate
+
{{ (100 * totalHeroReport.Count / totalPicks * playersPerMatch).toFixed(0) }}% Pick Rate
entry.Actor == this.selectedActor) .sort((entry1, entry2) => maps.getTalentRarityIndex(entry1.Talent) - maps.getTalentRarityIndex(entry2.Talent)); }, - totalHeroPicks: function() { + totalHeroReport: function() { return this.heroReport - .map((entry) => entry.Count) - .reduce((agg, cur) => agg + cur, 0); + .map((entry) => ({ 'Winner': entry.Count * entry.Winner, 'Count': entry.Count })) + .reduce((agg, cur) => + ({ 'Winner': agg.Winner + cur.Winner, 'Count': agg.Count + cur.Count }), + { 'Winner': 0, 'Count': 0 }); }, playersPerMatch: function() { return maps.playersPerMatch(this.selectedMode); -- cgit v1.3.1