summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-09-12 23:56:45 +0200
committerTor Andersson <tor@ccxvii.net>2023-09-13 20:06:36 +0200
commitb1b753e317daa10e03a6a3b210d185539fac176b (patch)
treeb389ae89f689af3a7d0fb77cb89d46271e18bfc5 /views
parent6407378d92eb8880e35e8ee33e1801136a1a44a7 (diff)
downloadserver-b1b753e317daa10e03a6a3b210d185539fac176b.tar.gz
Calculate Elo ratings.
Primarily for use with future matchmaking system to provide better games for everyone. Show top 5 players of each game on the game pages.
Diffstat (limited to 'views')
-rw-r--r--views/game_stats.pug25
-rw-r--r--views/user_stats.pug34
2 files changed, 49 insertions, 10 deletions
diff --git a/views/game_stats.pug b/views/game_stats.pug
new file mode 100644
index 0000000..a60d7cb
--- /dev/null
+++ b/views/game_stats.pug
@@ -0,0 +1,25 @@
+//- vim:ts=4:sw=4:
+doctype html
+html
+ head
+ include head
+ title #{title_name} - Ranking
+ body
+ include header
+ article
+ h1 #{title_name} - Ranking
+
+ table(style="min-width:auto")
+ thead
+ tr
+ th Player
+ th.r Rating
+ th.r Plays
+ th.r Last played
+ tbody
+ each row in ratings
+ tr
+ td= row.name
+ td.r= row.rating
+ td.r= row.count
+ td.r= row.last
diff --git a/views/user_stats.pug b/views/user_stats.pug
index a947b64..dee2883 100644
--- a/views/user_stats.pug
+++ b/views/user_stats.pug
@@ -5,12 +5,11 @@ doctype html
html
head
include head
- title Stats for #{who.name}
- style td:nth-child(n+4){text-align:right}
+ title Statistics for #{who.name}
body
include header
article
- h1 Stats for #{who.name}
+ h1 Statistics for #{who.name}
table(style="min-width:auto")
thead
@@ -18,8 +17,8 @@ html
th Title
th Scenario
th Role
- th Played
- th Won
+ th.r Played
+ th.r Won
tbody
each row in stats
tr
@@ -28,12 +27,27 @@ html
td= row.title_name
td= row.scenario
td= row.role
- td= row.total
- td= Math.round(row.won*100/row.total) + "%"
+ td.r= row.total
+ td.r= Math.round(row.won*100/row.total) + "%"
tfoot
tr
+ td Overall
td
td
- td
- td= all_total
- td= Math.round(all_won*100/all_total) + "%"
+ td.r= all_total
+ td.r= Math.round(all_won*100/all_total) + "%"
+
+ table(style="min-width:auto")
+ thead
+ tr
+ th Title
+ th.r Rating
+ th.r Plays
+ th.r Last played
+ tbody
+ each row in ratings
+ tr
+ td= row.title_name
+ td.r= row.rating
+ td.r= row.count
+ td.r= row.last