summaryrefslogtreecommitdiff
path: root/src/Summaries.vue
blob: 51bd27757b4375e32421e69eb9a1da4b89b3bfcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<template>
  <b-table :data="talentSummaries"
           :mobile-cards="false">
    <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>

    <template slot-scope="props">
      <b-table-column field="Rarity" label="Rarity">
        {{ props.row.Rarity }}
      </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>