From 248ad699ab9d08828bbe17672776a7cb88d8ce3c Mon Sep 17 00:00:00 2001 From: Pisces000221 <1786762946@qq.com> Date: Sun, 31 Dec 2017 14:12:43 +0800 Subject: [PATCH] Add score display in IOI contests --- modules/contest.js | 3 +++ views/contest.ejs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/contest.js b/modules/contest.js index 0ad9723..2ac5101 100644 --- a/modules/contest.js +++ b/modules/contest.js @@ -176,6 +176,9 @@ app.get('/contest/:id', async (req, res) => { let judge_state = await JudgeState.fromID(player.score_details[problem.problem.id].judge_id); problem.status = judge_state.status; problem.judge_id = player.score_details[problem.problem.id].judge_id; + await contest.loadRelationships(); + let multiplier = contest.ranklist.ranking_params[problem.problem.id] || 1.0; + problem.feedback = (judge_state.score * multiplier).toString() + ' / ' + (100 * multiplier).toString(); } } else if (contest.type === 'acm') { if (player.score_details[problem.problem.id]) { diff --git a/views/contest.ejs b/views/contest.ejs index 2f8b4c1..8ee23a5 100644 --- a/views/contest.ejs +++ b/views/contest.ejs @@ -76,7 +76,7 @@ <% if (typeof problem.status === 'string') { %> - <%= problem.status %> + <%= problem.feedback || problem.status %> <% } else if (typeof problem.status === 'object') { %> <% if (problem.status.accepted) { %>