blob: db497e871b85c1da277f0949f7cf51ecbd1fc5c8 (
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
|
<%- include('header', { title: "Game Statistics" }) -%>
<style>tr.blank{height:2rem;border:none;}</style>
<table class="wide">
<%
let total = {};
let results = {};
for (let { title_name, scenario, result, count } of stats) {
if (total[title_name] == undefined)
total[title_name] = {};
if (total[title_name][scenario] == undefined)
total[title_name][scenario] = 0;
total[title_name][scenario] += count;
if (results[title_name] == undefined)
results[title_name] = [];
if (!results[title_name].includes(result))
results[title_name].push(result);
}
let last_title = null;
let last_scenario = null;
for (let { title_name, scenario, result, count } of stats) {
if (title_name != last_title) {
if (last_title != null) {
%><tr class="blank"><%
}
%><tr><th><%= title_name %><%
results[title_name].forEach(item => { %><th><%= item %><% });
}
if (scenario != last_scenario) {
%><tr><td><%= scenario %> (<%= total[title_name][scenario] %>)<%
}
%><td><%= Math.round(count * 100 / total[title_name][scenario]) %>%<%
last_title = title_name;
last_scenario = scenario;
}
%>
</table>
|