diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2018-07-24 21:28:59 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2018-12-13 17:09:33 +0100 |
| commit | b4841a1a73be0735d1395c4539506cb58d8ba285 (patch) | |
| tree | de28494391efe8ab415f8f634e9731a79984db7c /src | |
| parent | cb27e8d019ed97c4d72a893bd0287109f2158116 (diff) | |
| download | brokentalents-b4841a1a73be0735d1395c4539506cb58d8ba285.tar.gz brokentalents-b4841a1a73be0735d1395c4539506cb58d8ba285.zip | |
Add Summaries card for Talents
Diffstat (limited to 'src')
| -rw-r--r-- | src/ModeTab.vue | 7 | ||||
| -rw-r--r-- | src/ReportService.js | 30 |
2 files changed, 29 insertions, 8 deletions
diff --git a/src/ModeTab.vue b/src/ModeTab.vue index 0a905c8..14bb960 100644 --- a/src/ModeTab.vue +++ b/src/ModeTab.vue @@ -39,6 +39,11 @@ <win-pick-scatter></win-pick-scatter> </div> + <div class="box" v-show="hasTalents"> + <h2 class="title is-2">Summaries</h2> + <summaries></summaries> + </div> + <Adsense class="adsense" data-ad-client="ca-pub-6856963757796636" data-ad-slot="4801023518"> @@ -68,6 +73,7 @@ import ReportTable from './ReportTable.vue'; import IntroBox from './IntroBox.vue'; import InstallNotification from './InstallNotification.vue'; import WinPickScatter from './WinPickScatter.vue'; +import Summaries from './Summaries.vue'; import RouterParamMixin from './RouterParamMixin'; import * as maps from './maps/maps.js'; @@ -92,6 +98,7 @@ export default Vue.component('mode-tab', { IntroBox, WinPickScatter, InstallNotification, + Summaries, }, }); </script> diff --git a/src/ReportService.js b/src/ReportService.js index a050bb4..67f9464 100644 --- a/src/ReportService.js +++ b/src/ReportService.js @@ -1,5 +1,6 @@ import * as maps from './maps/maps'; import * as metadata from '../data/2d73896c/metadata.json'; +import * as R from 'ramda'; const POPULAR_THRESHOLD = 1.0; // percent const PICKS_THRESHOLD = 300; // picks @@ -22,6 +23,7 @@ const topUnpopularWins = new Map(); const topKillDeathPoints = new Map(); const topObjectivePoints = new Map(); const topBlitzPointsDelta = new Map(); +const summaryTalents = new Map(); let totalMatches = 0; let actors = []; const modes = metadata.config.api.modes; @@ -75,11 +77,13 @@ for(let mode of modes) { const rsquare = 1 - ssres / sstot; return Object.assign({}, entry, { - TalentWinrateBase: intercept, - TalentWinrateScaling: slope, // to 1 = max level - TalentWinrateMax: intercept + slope, - TalentWinrateLevelScaling: slope / maps.getMaxLevel(entry), - TalentWinrateVariance: rsquare, + _Count: 1, // TODO find a cleaner solution to convert the sum of relatives to absolutes in summaries + Rarity: maps.getTalentRarity(entry.Talent), + TalentWinrateBase: intercept || entry.Winner, + TalentWinrateScaling: slope || 0, // to 1 = max level + TalentWinrateMax: (intercept + slope) || entry.Winner, + TalentWinrateLevelScaling: (slope / maps.getMaxLevel(entry)) || 0, + TalentWinrateVariance: rsquare || 0, TotalPicks: sum_weights || entry.Count, // NoTalent has no weights TotalWinner: sum_y / sum_weights || entry.Winner, SampleTooSmall: sum_weights < PICKS_THRESHOLD, @@ -107,13 +111,13 @@ for(let mode of modes) { entry.TotalPicks > PICKS_THRESHOLD) .sort((entry1, entry2) => entry2.TotalWinner - entry1.TotalWinner)[0]); topRareWins.set(mode, reports.get(mode) - .filter((entry) => maps.getTalentRarity(entry.Talent) == 'Rare' && 100 * playersPerMatch * entry.TotalPicks / totalPicks.get(mode)) + .filter((entry) => entry.Rarity == 'Rare' && 100 * playersPerMatch * entry.TotalPicks / totalPicks.get(mode)) .sort((entry1, entry2) => entry2.TotalWinner - entry1.TotalWinner)[0]); topEpicWins.set(mode, reports.get(mode) - .filter((entry) => maps.getTalentRarity(entry.Talent) == 'Epic' && 100 * playersPerMatch * entry.TotalPicks / totalPicks.get(mode)) + .filter((entry) => entry.Rarity == 'Epic' && 100 * playersPerMatch * entry.TotalPicks / totalPicks.get(mode)) .sort((entry1, entry2) => entry2.TotalWinner - entry1.TotalWinner)[0]); topLegendaryWins.set(mode, reports.get(mode) - .filter((entry) => maps.getTalentRarity(entry.Talent) == 'Legendary' && 100 * playersPerMatch * entry.TotalPicks / totalPicks.get(mode)) + .filter((entry) => entry.Rarity == 'Legendary' && 100 * playersPerMatch * entry.TotalPicks / totalPicks.get(mode)) .sort((entry1, entry2) => entry2.TotalWinner - entry1.TotalWinner)[0]); topLowLevel.set(mode, reports.get(mode) .filter((entry) => !entry.SampleTooSmall && !entry.VarianceTooLarge && !!entry.TalentWinrateBase) @@ -131,6 +135,12 @@ for(let mode of modes) { .filter((entry) => !entry.SampleTooSmall && !entry.VarianceTooLarge && !!entry.BlitzPointsDelta) .sort((entry1, entry2) => entry2.BlitzPointsDelta - entry1.BlitzPointsDelta)[0]); + summaryTalents.set(mode, + new Map(Object.entries( + R.reduceBy(R.mergeWith((a, b) => R.is(String, a) ? a : R.add(a, b) ), 0, R.prop('Rarity'), reports.get(mode)) + )) + ); + if (actors.length == 0) { actors = [...new Set(reports.get(mode).map((entry) => entry.Actor))]; } @@ -223,6 +233,10 @@ export default { return topBlitzPointsDelta.get(mode); }, + getSummaryTalents(mode) { + return summaryTalents.get(mode); + }, + getActors() { return actors; }, |
