summaryrefslogtreecommitdiff
path: root/views/user_stats.pug
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-11-25 19:39:21 +0100
committerTor Andersson <tor@ccxvii.net>2021-11-25 19:41:54 +0100
commit86848b6cae751439be2946eae563d3fa8caa434c (patch)
tree24324e1ed177985961479ecd162b34f34f7f3156 /views/user_stats.pug
parent4bce77f2c21846baa72161a4a55362c1ed0dd29c (diff)
downloadserver-86848b6cae751439be2946eae563d3fa8caa434c.tar.gz
Update stat views.
Diffstat (limited to 'views/user_stats.pug')
-rw-r--r--views/user_stats.pug38
1 files changed, 38 insertions, 0 deletions
diff --git a/views/user_stats.pug b/views/user_stats.pug
new file mode 100644
index 0000000..70211ef
--- /dev/null
+++ b/views/user_stats.pug
@@ -0,0 +1,38 @@
+//- vim:ts=4:sw=4:
+- let all_won = 0
+- let all_total = 0
+doctype html
+html
+ head
+ include head
+ title Stats for #{who.name}
+ style td:nth-child(3),td:nth-child(4){text-align:right}
+ body
+ include header
+ article
+ h1 Stats for #{who.name}
+
+ table(style="min-width:auto")
+ tr
+ th Title
+ th Scenario
+ th Won
+ th Total
+ each row in stats
+ tr
+ - all_won += row.won
+ - all_total += row.total
+ td= row.title_name
+ td= row.scenario
+ td= row.won
+ td= row.total
+ tr
+ th
+ th
+ th
+ th
+ tr
+ td
+ td
+ td= Math.round(all_won * 100 / all_total) + "%"
+ td= all_total