summaryrefslogtreecommitdiff
path: root/src/report-service.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2018-05-21 13:42:58 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2018-12-13 16:59:34 +0100
commit30c12345f652999c405ee33d1af16de5a3f59be1 (patch)
treedadddc1ba8bc9d81c5e1900c63c9851521d96e65 /src/report-service.js
parent3bb3449f6f1215ee767f1e0e05c6bf0783e58481 (diff)
downloadbrokentalents-30c12345f652999c405ee33d1af16de5a3f59be1.tar.gz
brokentalents-30c12345f652999c405ee33d1af16de5a3f59be1.zip
Add more highlights
Diffstat (limited to 'src/report-service.js')
-rw-r--r--src/report-service.js41
1 files changed, 40 insertions, 1 deletions
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;
}