summaryrefslogtreecommitdiff
path: root/src/report-service.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2018-05-21 13:09:05 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2018-12-13 16:59:33 +0100
commitaea0fa999fd09951835b2d74c53137624f46929e (patch)
tree3d806b7b5c5dd8b95fd07d6f3402d2231cf981d4 /src/report-service.js
parent73e2c234f2f52357b21fd9fe9b956eeabb8ddc62 (diff)
downloadbrokentalents-aea0fa999fd09951835b2d74c53137624f46929e.tar.gz
brokentalents-aea0fa999fd09951835b2d74c53137624f46929e.zip
major redesign
Diffstat (limited to 'src/report-service.js')
-rw-r--r--src/report-service.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/report-service.js b/src/report-service.js
index 98b7bfa..91ef15d 100644
--- a/src/report-service.js
+++ b/src/report-service.js
@@ -7,14 +7,20 @@ export default class ReportService {
this.reports = {};
this.totalPicks = {};
+ this.top10Relevancy = {};
this.topPicks = {};
this.topWins = {};
this.topLeveledUp = {};
this.topLeveledDown = {};
+ this.actors = [];
+ this.modes = MODES;
for(let mode of MODES) {
+ const relevancy = (entry) => (entry.Count / this.totalPicks[mode]) * (entry.Winner / entry.Count);
+
this.reports[mode] = this.report.filter((entry) => entry.Mode == mode);
this.totalPicks[mode] = this.report.map((entry) => entry.Count).reduce((agg, cur) => agg + cur, 0);
+ 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)
@@ -30,6 +36,10 @@ export default class ReportService {
return entry1.Level < entry2.Level ? -1 : 1;
})[0];
+
+ if (this.actors.length == 0) {
+ this.actors = [...new Set(this.reports[mode].map((entry) => entry.Actor))];
+ }
}
}
@@ -45,6 +55,10 @@ export default class ReportService {
return this.topPicks[mode];
}
+ getTop10Picks(mode) {
+ return this.top10Relevancy[mode];
+ }
+
getHighestLevelAvg(mode) {
return this.topLeveledUp[mode];
}
@@ -56,4 +70,12 @@ export default class ReportService {
getTopWin(mode) {
return this.topWins[mode];
}
+
+ getActors() {
+ return this.actors;
+ }
+
+ getModes() {
+ return this.modes;
+ }
}