From a1fe768c6d40c7c885db1c9843c61527cbe583e3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 20 Nov 2021 19:47:08 +0100 Subject: Rewrite view templates to use Pug engine. --- views/stats.ejs | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 views/stats.ejs (limited to 'views/stats.ejs') diff --git a/views/stats.ejs b/views/stats.ejs deleted file mode 100644 index 95b52d2..0000000 --- a/views/stats.ejs +++ /dev/null @@ -1,39 +0,0 @@ -<%- 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) %>%<% - }); - } - }); - %>
-- cgit v1.2.3