From fcc78a3f9f5420df428132033586f7a432598d10 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Wed, 27 Mar 2019 09:35:11 +0100 Subject: [PATCH] Added trophies --- server.js | 3 +++ views/base.pug | 2 +- views/index.pug | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index ec2d43c..51b4b45 100644 --- a/server.js +++ b/server.js @@ -97,6 +97,9 @@ function parse(data) { } parsed.sortedAis.sort((a, b) => b.score - a.score); + parsed.sortedAis[0].rank = 1; + parsed.sortedAis[1].rank = 2; + parsed.sortedAis[2].rank = 3; return parsed; } diff --git a/views/base.pug b/views/base.pug index d78b0a1..228fc3e 100644 --- a/views/base.pug +++ b/views/base.pug @@ -4,8 +4,8 @@ html(lang='en') meta(charset='utf-8') meta(name='viewport', content='width=device-width, initial-scale=1, shrink-to-fit=no') link(rel='stylesheet', href='/static/main.css') - body.layout-documentation.page-components block extracss + body.layout-documentation.page-components title Pytron nav.navbar.is-link(role='navigation', aria-label='main navigation') .container diff --git a/views/index.pug b/views/index.pug index 15eaeb4..399090b 100644 --- a/views/index.pug +++ b/views/index.pug @@ -1,5 +1,8 @@ extends base +block extracss + link(rel="stylesheet", href="https://use.fontawesome.com/releases/v5.8.1/css/all.css", integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf", crossorigin="anonymous") + block content section.section .container @@ -19,6 +22,15 @@ block content for ai in data.sortedAis tr td.has-text-centered + if ai.rank === 1 + span.icon + i.fas.fa-trophy(style="color:#FFD700") + else if ai.rank === 2 + span.icon + i.fas.fa-trophy(style="color:#C0C0C0") + else if ai.rank === 3 + span.icon + i.fas.fa-trophy(style="color:#CD7F32") strong= ai.name td.has-text-centered= ai.victories td.has-text-centered= ai.nulls