You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
5.7 KiB

8 years ago
<% this.title = contest.title + ' - 比赛' %>
<style>
.ui.label.pointing.below.left::before { left: 12%; }
.ui.label.pointing.below.right::before { left: 88%; }
.ui.label.pointing.below.left { margin-bottom: 0; }
.ui.label.pointing.below.right { margin-bottom: 0; float: right; }
#back_to_contest { display: none; }
</style>
8 years ago
<% include header %>
<div class="padding">
<h1><%= contest.title %></h1>
<div style="margin-bottom: 30px;"><%- contest.subtitle %></div>
<% let unveiled = (isSupervisior || syzoj.utils.getCurrentDate() >= contest.start_time); %>
<% const seeResult = (isSupervisior || contest.ended) %>
<% let start = syzoj.utils.formatDate(contest.start_time), end = syzoj.utils.formatDate(contest.end_time); %>
<% if (contest.running && start.split(' ')[0] === end.split(' ')[0]) {
start = start.split(' ')[1]; end = end.split(' ')[1];
} %>
<div class="ui pointing below left label"><%= start %></div>
<div class="ui pointing below right label"><%= end %></div>
<% let timePercentage = Math.floor(Math.min(1, (syzoj.utils.getCurrentDate() - contest.start_time) / (contest.end_time - contest.start_time)) * 100); %>
<div id="timer-progress" class="ui tiny indicating progress<% if (timePercentage == 100) { %> success<% } %>" data-percent="<%= timePercentage %>">
<div class="bar" style="width: <%= timePercentage %>%;"></div>
</div>
8 years ago
<div class="ui grid">
<div class="row">
<div class="column">
<div class="ui buttons">
<% if(seeResult) { %>
<a class="ui small blue button" href="<%= syzoj.utils.makeUrl(['contest', contest.id, 'ranklist']) %>">排行榜</a>
<% } %>
<% let submissionsUrl = seeResult ?
syzoj.utils.makeUrl(['submissions'], {contest: contest.id}) :
syzoj.utils.makeUrl(['contest', contest.id, 'submissions']); %>
<a class="ui small positive button" href="<%= submissionsUrl %>">提交记录</a>
<% if (isSupervisior) { %>
<a class="ui small button" href="<%= syzoj.utils.makeUrl(['contest', contest.id, 'edit']) %>">编辑比赛</a>
<% } %>
8 years ago
</div>
</div>
</div>
<% if (contest.information) { %>
8 years ago
<div class="row">
<div class="column">
<h4 class="ui top attached block header">信息与公告</h4>
8 years ago
<div class="ui bottom attached segment font-content">
8 years ago
<%- contest.information %>
</div>
</div>
</div>
<% } %>
<% if (unveiled) { %>
8 years ago
<div class="row">
<div class="column">
<table class="ui selectable celled table">
<thead>
<tr>
<th class="one wide" style="text-align: center">状态</th>
<th>题目</th>
<% if (hasStatistics) { %>
<th class="one wide center aligned">统计</th>
<% } %>
8 years ago
</tr>
</thead>
<tbody>
<%
let i = 0;
for (let problem of problems) {
i++;
%>
<tr>
<td class="center aligned" style="white-space: nowrap; ">
<% if (problem.judge_id) { %>
<a href="<%= syzoj.utils.makeUrl(['contest', 'submission', problem.judge_id]) %>">
<% if (typeof problem.status === 'string') { %>
8 years ago
<span class="status <%= problem.status.toLowerCase().split(' ').join('_') %>">
8 years ago
<i class="<%= icon[getStatusMeta(problem.status)] || 'remove' %> icon"></i>
8 years ago
<%= problem.status %>
</span>
<% } else if (typeof problem.status === 'object') { %>
<% if (problem.status.accepted) { %>
<span class="score score_10">
<% if (problem.status.unacceptedCount === 0) { %>
+
<% } else { %>
+<%= problem.status.unacceptedCount %>
<% } %>
</span>
<% } else { %>
<span class="score score_0">
<% if (problem.status.unacceptedCount !== 0) { %>
-<%= problem.status.unacceptedCount %>
<% } %>
</span>
<% } %>
8 years ago
<% } %>
<% } %>
</td>
<td><a href="<%= syzoj.utils.makeUrl(['contest', contest.id, 'problem', i]) %>"><%= syzoj.utils.removeTitleTag(problem.problem.title) %></a></td>
<% if (hasStatistics) { %>
<td class="center aligned" style="white-space: nowrap; ">
<a href="<%= syzoj.utils.makeUrl(['contest', contest.id, 'submissions'], { problem_id: i, status: 'Accepted' }) %>"><%= problem.statistics.accepted %></a>
/
<a href="<%= syzoj.utils.makeUrl(['contest', contest.id, 'submissions'], { problem_id: i, min_score: 1 }) %>"><%= problem.statistics.partially %></a>
<% if (contest.type === 'noi' || contest.type === 'ioi') { %>
/
<% } %>
<a href="<%= syzoj.utils.makeUrl(['contest', contest.id, 'submissions'], { problem_id: i }) %>"><%= problem.statistics.attempt %></a>
</td>
<% } %>
8 years ago
</tr>
<% } %>
</tbody>
</table>
</div>
</div>
<% } %>
8 years ago
</div>
</div>
<script>
$(function () {
setInterval(function () {
$('#timer-progress').progress({
value: Date.now() / 1000 - <%= contest.start_time %>,
total: <%= contest.end_time - contest.start_time %>
});
}, 5000);
});
</script>
8 years ago
<% include footer %>