diff --git a/views/contest_ranklist.ejs b/views/contest_ranklist.ejs
index b93d3aa..319975f 100644
--- a/views/contest_ranklist.ejs
+++ b/views/contest_ranklist.ejs
@@ -46,35 +46,44 @@
problem.min = minPos;
}
- let i = 0;
+ let i = 0, rank = 0, lastItem;
for (let item of ranklist) {
- i++
+ i++;
let latest = contest.start_time, timeSum = 0, unacceptedCount = 0;
%>
+ <%
+ if (contest.type === 'noi' || contest.type === 'ioi') {
+ console.log(i);
+ console.log(lastItem);
+ if (i === 1 || item.player.score !== lastItem.player.score) rank++;
+ } else if (contest.type === 'acm') {
+ for (let problem of problems) {
+ if (item.player.score_details[problem.id] && item.player.score_details[problem.id].accepted) {
+ timeSum += (item.player.score_details[problem.id].acceptedTime - contest.start_time) + (item.player.score_details[problem.id].unacceptedCount * 20 * 60);
+ unacceptedCount += item.player.score_details[problem.id].unacceptedCount;
+ }
+ }
+ item.player.timeSum = timeSum;
+
+ if (i === 1 || item.player.score !== lastItem.player.score || item.player.timeSum !== lastItem.player.timeSum) rank++;
+ }
+ %>
- <% if (i == 1) { %>
+ <% if (rank == 1) { %>
- <% } else if (i == 2) { %>
+ <% } else if (rank == 2) { %>
- <% } else if (i == 3) { %>
+ <% } else if (rank == 3) { %>
<% } else { %>
<% } %>
- <%= i %>
+ <%= rank %>
|
<%= item.user.username %><% if (item.user.nameplate) { %><%- item.user.nameplate %><% } %> |
- <%
- if (contest.type === 'acm') {
- for (let problem of problems) {
- if (item.player.score_details[problem.id] && item.player.score_details[problem.id].accepted) {
- timeSum += (item.player.score_details[problem.id].acceptedTime - contest.start_time) + (item.player.score_details[problem.id].unacceptedCount * 20 * 60);
- unacceptedCount += item.player.score_details[problem.id].unacceptedCount;
- }
- }
- %>
+ <% if (contest.type === 'acm') { %>
<%= item.player.score %>
@@ -137,6 +146,7 @@
|
<% } %>
+ <% lastItem = item; %>
<% } %>