From 30c12345f652999c405ee33d1af16de5a3f59be1 Mon Sep 17 00:00:00 2001 From: schneefux Date: Mon, 21 May 2018 13:42:58 +0200 Subject: Add more highlights --- src/report-service.js | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'src/report-service.js') diff --git a/src/report-service.js b/src/report-service.js index 91ef15d..9fdbbf3 100644 --- a/src/report-service.js +++ b/src/report-service.js @@ -1,4 +1,7 @@ +import * as maps from './maps/maps'; + const MODES = [ 'casual_aral', 'blitz_pvp_ranked' ]; +const POPULAR_THRESHOLD = 0.1; export default class ReportService { constructor() { @@ -10,8 +13,12 @@ export default class ReportService { this.top10Relevancy = {}; this.topPicks = {}; this.topWins = {}; + this.topRareWins = {}; + this.topEpicWins = {}; + this.topLegendaryWins = {}; this.topLeveledUp = {}; this.topLeveledDown = {}; + this.topUnpopularWins = {}; this.actors = []; this.modes = MODES; @@ -23,7 +30,19 @@ export default class ReportService { this.top10Relevancy[mode] = this.reports[mode].sort((entry1, entry2) => relevancy(entry2) - relevancy(entry1)).slice(0, 10); this.topPicks[mode] = this.reports[mode].sort((entry1, entry2) => entry2.Count - entry1.Count)[0]; this.topWins[mode] = this.reports[mode] - .filter((entry) => 100 * 6 * entry.Count / this.totalPicks[mode] > 0.05) + .filter((entry) => 100 * 6 * entry.Count / this.totalPicks[mode] > POPULAR_THRESHOLD) + .sort((entry1, entry2) => entry2.Winner - entry1.Winner)[0]; + this.topUnpopularWins[mode] = this.reports[mode] + .filter((entry) => 100 * 6 * entry.Count / this.totalPicks[mode] <= POPULAR_THRESHOLD) + .sort((entry1, entry2) => entry2.Winner - entry1.Winner)[0]; + this.topRareWins[mode] = this.reports[mode] + .filter((entry) => maps.getTalentRarity(entry.Talent) == 'Rare' && 100 * 6 * entry.Count / this.totalPicks[mode] > POPULAR_THRESHOLD) + .sort((entry1, entry2) => entry2.Winner - entry1.Winner)[0]; + this.topEpicWins[mode] = this.reports[mode] + .filter((entry) => maps.getTalentRarity(entry.Talent) == 'Epic' && 100 * 6 * entry.Count / this.totalPicks[mode] > POPULAR_THRESHOLD) + .sort((entry1, entry2) => entry2.Winner - entry1.Winner)[0]; + this.topLegendaryWins[mode] = this.reports[mode] + .filter((entry) => maps.getTalentRarity(entry.Talent) == 'Legendary' && 100 * 6 * entry.Count / this.totalPicks[mode] > POPULAR_THRESHOLD) .sort((entry1, entry2) => entry2.Winner - entry1.Winner)[0]; this.topLeveledUp[mode] = this.reports[mode].sort((entry1, entry2) => { if (!entry1.Level) return 1; @@ -71,6 +90,26 @@ export default class ReportService { return this.topWins[mode]; } + getTopUnpopularWin(mode) { + return this.topUnpopularWins[mode]; + } + + getTopRareWins(mode) { + return this.topRareWins[mode]; + } + + getTopEpicWins(mode) { + return this.topEpicWins[mode]; + } + + getTopLegendaryWins(mode) { + return this.topLegendaryWins[mode]; + } + + getBestUnpopular(mode) { + return this.topUnpopular[mode]; + } + getActors() { return this.actors; } -- cgit v1.3.1