<%- include('header', { title: "Game Statistics" }) -%> <% 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) { if (title_name_map[title_id].hidden) continue; let scenarios = title_rule_map[title_id].scenarios; let roles = title_role_map[title_id].concat(['Draw']); %><% } %>
<%= title_name_map[title_id].title_name %><% roles.forEach(role => { %><%= role %><% }); scenarios.forEach(scenario => { let t = total(title_id, scenario); if (t > 0) { %>
<%= scenario %> (<%= t %>)<% roles.forEach(role => { let r = result(title_id, scenario, role); %><%= Math.round(r * 100 / t) %>%<% }); } }); %>