From b3bfa59817505347148c11f6d96ad0d492d6df1c Mon Sep 17 00:00:00 2001
From: schneefux <schneefux+commit@schneefux.xyz>
Date: Tue, 24 Jul 2018 21:47:50 +0200
Subject: Add Summaries card for Talents (ctd.)

automatic build
---
 src/Summaries.vue | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 src/Summaries.vue

(limited to 'src/Summaries.vue')

diff --git a/src/Summaries.vue b/src/Summaries.vue
new file mode 100644
index 0000000..cc20fb8
--- /dev/null
+++ b/src/Summaries.vue
@@ -0,0 +1,58 @@
+<template>
+  <b-table :data="talentSummaries"
+           :mobile-cards="false">
+    <template slot-scope="props">
+      <template slot-scope="props" slot="header">
+        <b-tooltip :active="!!props.column.meta" :label="props.column.meta || ''" position="is-bottom" dashed>
+          {{ props.column.label }}
+        </b-tooltip>
+      </template>
+
+      <b-table-column field="Rarity" label="Rarity">
+        {{ props.row.Rarity }}
+      </b-table-column>
+
+      <b-table-column field="TotalWinner" label="Win Rate" sortable numeric>
+        {{ (100 * props.row.TotalWinner / props.row._Count).toFixed(2) }}%
+      </b-table-column>
+
+      <b-table-column field="TalentWinrateBase" label="Level 1 Win Rate" meta="Estimated." sortable numeric>
+        {{ (100 * props.row.TalentWinrateBase / props.row._Count).toFixed(2) }}%
+      </b-table-column>
+
+      <b-table-column field="TalentWinrateMax" label="Max Level Win Rate" meta="Estimated." sortable numeric>
+        {{ (100 * props.row.TalentWinrateMax / props.row._Count).toFixed(2) }}%
+      </b-table-column>
+
+      <b-table-column field="TotalPicks" label="Pick Rate" sortable numeric>
+        {{ (100 * props.row.TotalPicks / totalPicks).toFixed(2) }}%
+      </b-table-column>
+    </template>
+  </b-table>
+</template>
+
+<script>
+import Vue from 'vue';
+import RouterParamMixin from './RouterParamMixin';
+import ReportService from './ReportService';
+import * as maps from './maps/maps';
+
+export default Vue.component('summaries', {
+  mixins: [ RouterParamMixin ],
+  data: function() {
+    return {
+    };
+  },
+  computed: {
+    talentSummaries: function() {
+      return [...ReportService.getSummaryTalents(this.selectedMode).values()]
+          .sort((entry1, entry2) => maps.getTalentRarityIndex(entry1.Talent) - maps.getTalentRarityIndex(entry2.Talent));
+    },
+    totalPicks: function() {
+      return this.talentSummaries.map((entry) => entry.TotalPicks).reduce((agg, cur) => agg + cur, 0);
+    },
+  },
+  components: {
+  },
+});
+</script>
-- 
cgit v1.3.1

