blob: 64a6303fcb101c03e85e7e0595a2486783391c7f (
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
|
<%- include('header', { title: "Game Statistics" }) -%>
<style>tr.blank{height:2rem;border:none;}</style>
<table class="wide">
<%
function total(t, s) {
return stats
.filter(entry => entry.title_id === t && entry.scenario === s)
.reduce((acc, entry) => acc + entry.count, 0);
}
function result(t, s, r) {
let info = stats.find(entry => {
return entry.title_id === t &&
entry.scenario === s &&
entry.result === r});
return info ? info.count : 0;
}
for (let title_id in title_name_map) {
let scenarios = title_rule_map[title_id].scenarios;
let roles = title_role_map[title_id].concat(['Draw']);
%><tr><th><%= title_name_map[title_id] %><%
roles.forEach(role => {
%><th><%= role %><%
});
scenarios.forEach(scenario => {
let t = total(title_id, scenario);
if (t > 0) {
%><tr><td><%= scenario %> (<%= t %>)<%
roles.forEach(role => {
let r = result(title_id, scenario, role);
%><td><%= Math.round(r * 100 / t) %>%<%
});
}
});
%><tr class="blank"><%
}
%>
</table>
|