From 5bfadf1e16fec0e3e1af95ebdfa8cf6f43b97652 Mon Sep 17 00:00:00 2001 From: Menci Date: Mon, 3 Jul 2017 20:40:55 +0800 Subject: [PATCH] Show first AC as green in contest ranklist --- views/contest_ranklist.ejs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/views/contest_ranklist.ejs b/views/contest_ranklist.ejs index f7e5e03..28071be 100644 --- a/views/contest_ranklist.ejs +++ b/views/contest_ranklist.ejs @@ -31,6 +31,21 @@ <% + for (let problem of problems) { + let i = 0, min, minPos = -1; + for (let item of ranklist) { + i++; + let condition; + if (contest.type === 'acm') condition = item.player.score_details[problem.id] && (minPos === -1 || item.player.score_details[problem.id].acceptedTime < min.player.score_details[problem.id].acceptedTime); + else condition = item.player.score_details[problem.id] && item.player.score_details[problem.id].score === 100 && (minPos === -1 || item.player.score_details[problem.id].time < min.player.score_details[problem.id].time); + if (condition) { + min = item; + minPos = i; + } + } + problem.min = minPos; + } + let i = 0; for (let item of ranklist) { i++ @@ -70,10 +85,14 @@ <% } %> <% for (let problem of problems) { %> + <% if (problem.min === i) { %> + + <% } else { %> + + <% } %> <% if (!item.player.score_details[problem.id]) { %> - + <% } else if (contest.type === 'acm') { %> - <% if (item.player.score_details[problem.id].accepted) { %> @@ -95,7 +114,6 @@ <% } else if (contest.type === 'noi' || contest.type === 'ioi') { %> - <%= item.player.score_details[problem.id].score %>