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.
194 lines
8.3 KiB
194 lines
8.3 KiB
8 years ago
|
<%
|
||
|
// Sanitize judge results for backward compatibility and clarity
|
||
|
if (!judge.result.subtasks) {
|
||
|
judge.result.subtasks = [
|
||
|
{ case_num: judge.result.case_num, status: judge.result.status, score: judge.result.score }
|
||
|
];
|
||
|
for (let i = 0; i < judge.result.case_num; ++i) {
|
||
|
judge.result.subtasks[0][i] = judge.result[i];
|
||
|
}
|
||
|
}
|
||
|
let runningFound = false;
|
||
|
for (let s of judge.result.subtasks) {
|
||
|
s.pending = (s.status === 'Waiting' || s.status.startsWith('Running'));
|
||
|
for (let i = 0; i < s.case_num; ++i) if (!s[i]) {
|
||
|
s[i] = {
|
||
|
pending: true,
|
||
|
status: runningFound ? 'Waiting' : 'Running'
|
||
|
};
|
||
8 years ago
|
if (!runningFound) s.isActiveSubtask = true;
|
||
8 years ago
|
runningFound = true;
|
||
|
}
|
||
|
}
|
||
|
%>
|
||
|
|
||
8 years ago
|
<div class="padding">
|
||
8 years ago
|
<table class="ui very basic center aligned table" id="status_table">
|
||
8 years ago
|
<thead>
|
||
|
<tr>
|
||
|
<th>编号</th>
|
||
|
<th>题目名称</th>
|
||
|
<th>状态</th>
|
||
|
<th>分数</th>
|
||
|
<th>总时间</th>
|
||
|
<th>内存</th>
|
||
8 years ago
|
<th>代码</th>
|
||
8 years ago
|
<th>提交者</th>
|
||
|
<th>提交时间</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>#<%= judge.id %></td>
|
||
|
<td><a href="<%= syzoj.utils.makeUrl(['problem', judge.problem_id]) %>">#<%= judge.problem_id %>. <%= judge.problem.title %></a></td>
|
||
|
<% if (judge.allowedSeeResult) { %>
|
||
|
<td class="status <%= getStatusMeta(judge.result.status).toLowerCase().split(' ').join('_') %>">
|
||
|
<i class="<%= icon[getStatusMeta(judge.status)] || 'remove' %> icon"></i>
|
||
|
<%= judge.result.status %>
|
||
|
</td>
|
||
|
<td class="score score_<%= parseInt(judge.result.score / 10) || 0 %>"><%= judge.result.score %></td>
|
||
|
<td><%= judge.result.total_time %> ms</td>
|
||
8 years ago
|
<td><%= parseInt(judge.result.max_memory) || 0 %> K</td>
|
||
8 years ago
|
<td><%= syzoj.config.languages[judge.language].show %> / <%= syzoj.utils.formatSize(judge.codeLength) %></td>
|
||
8 years ago
|
<% } else { %>
|
||
|
<td>隐藏</td>
|
||
|
<td>隐藏</td>
|
||
|
<td>隐藏</td>
|
||
|
<td>隐藏</td>
|
||
8 years ago
|
<td>隐藏</td>
|
||
8 years ago
|
<% } %>
|
||
|
<td><a href="<%= syzoj.utils.makeUrl(['user', judge.user_id]) %>"><%= judge.user.username %></a><% if (judge.user.nameplate) { %><%- judge.user.nameplate %><% } %></td>
|
||
|
<td><%= syzoj.utils.formatDate(judge.submit_time) %></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<% if (judge.allowedSeeCode) { %>
|
||
8 years ago
|
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code id="code"><%- judge.code %></code></pre></div>
|
||
|
<script>
|
||
|
document.addEventListener('keydown', function (event) {
|
||
|
if ((event.ctrlKey || event.metaKey) && event.key === 'a') {
|
||
|
var sel = window.getSelection();
|
||
|
var rg = document.createRange()
|
||
|
rg.selectNodeContents(document.getElementById('code'));
|
||
|
sel.removeAllRanges();
|
||
|
sel.addRange(rg);
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
8 years ago
|
<% } %>
|
||
|
<% if (judge.result.compiler_output && judge.result.status === 'Compile Error' && judge.allowedSeeCode) { %>
|
||
|
<h3 class="ui header">编译信息</h3>
|
||
|
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%- judge.result.compiler_output %></code></pre></div>
|
||
|
<% } else if (judge.allowedSeeResult) { %>
|
||
8 years ago
|
<div class="ui styled fluid accordion" id="subtasks_list">
|
||
8 years ago
|
<% let subtask_count = 0; %>
|
||
|
<% for (let subtask_cases of (judge.result.subtasks || [])) { %>
|
||
|
<% if (judge.result.subtasks.length !== 1) { %>
|
||
8 years ago
|
<div class="title auto_update auto_update_activation<% if (subtask_cases.isActiveSubtask) { %> active<% } %>">
|
||
8 years ago
|
<div class="ui grid">
|
||
|
<div class="three wide column"><i class="dropdown icon"></i>子任务 #<%= ++subtask_count %></div>
|
||
|
<div class="four wide column status status_detail <%= getStatusMeta(subtask_cases.status).toLowerCase().split(' ').join('_') %>">
|
||
|
<i class="<%= icon[getStatusMeta(subtask_cases.status)] || 'remove' %> icon"></i>
|
||
|
<%= subtask_cases.status %></div>
|
||
|
<% if (!subtask_cases.pending) { %>
|
||
|
<div class="three wide column">得分:<span style="font-weight: normal; "><%= parseFloat(subtask_cases.score.toFixed(2)).toString() %></span></div>
|
||
|
<% } %>
|
||
|
</div>
|
||
|
</div>
|
||
8 years ago
|
<div class="content auto_update_activation<% if (subtask_cases.isActiveSubtask) { %> active<% } %>">
|
||
|
<div class="accordion">
|
||
8 years ago
|
<% } %>
|
||
|
<% for (let i = 0; i < subtask_cases.case_num; i++) { %>
|
||
|
<% let testcase = subtask_cases[i]; %>
|
||
8 years ago
|
<div class="title<% if (testcase.pending) { %> testcase.pending<% } %> auto_update"<% if (testcase.pending) { %> style="cursor: auto; "<% } %>>
|
||
8 years ago
|
<div class="ui grid">
|
||
|
<div class="three wide column"><i class="dropdown icon"></i>测试点 #<%= i + 1 %></div>
|
||
|
<div class="four wide column status status_detail <%= getStatusMeta(testcase.status).toLowerCase().split(' ').join('_') %>">
|
||
|
<i class="<%= icon[getStatusMeta(testcase.status)] || 'remove' %> icon"></i>
|
||
|
<%= testcase.status %></div>
|
||
|
<% if (!testcase.pending) { %>
|
||
|
<% if (!testcase.score) testcase.score = testcase.status === 'Accepted' ? 100 : 0; %>
|
||
|
<div class="three wide column">得分:<span style="font-weight: normal; "><%= parseFloat(testcase.score.toFixed(2)).toString() %></span></div>
|
||
|
<div class="three wide column">用时:<span style="font-weight: normal; "><%= testcase.time_used %> ms</span></div>
|
||
|
<div class="three wide column">内存:<span style="font-weight: normal; "><%= testcase.memory_used %> KiB</span></div>
|
||
|
<% } %>
|
||
|
</div>
|
||
|
</div>
|
||
8 years ago
|
<div class="content auto_update">
|
||
8 years ago
|
<% if (!testcase.pending) { %>
|
||
|
<p>
|
||
|
<strong>输入文件</strong>
|
||
|
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%= testcase.input %></code></pre></div>
|
||
|
<strong>期望输出</strong>
|
||
|
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%= testcase.answer %></code></pre></div>
|
||
|
<strong>你的输出</strong>
|
||
|
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%= testcase.user_out %></code></pre></div>
|
||
|
<% if (testcase.spj_message) { %>
|
||
|
<strong>Special Judge 信息</strong>
|
||
|
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%= testcase.spj_message %></code></pre></div>
|
||
|
<% } %>
|
||
|
</p>
|
||
8 years ago
|
<% } %>
|
||
|
</div>
|
||
8 years ago
|
<% } %>
|
||
8 years ago
|
<% if (judge.result.subtasks.length !== 1) { %>
|
||
|
</div></div>
|
||
|
<% } %>
|
||
8 years ago
|
<% } %>
|
||
|
</div>
|
||
|
<% } %>
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
$(function() {
|
||
|
$('.ui.accordion').accordion({
|
||
|
selector: {
|
||
|
trigger: '.title:not(.pending)'
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
|
||
8 years ago
|
<% if (!isPending(judge.status)) { %><div><div id="stop_ajax"></div></div><% } %>
|
||
8 years ago
|
<script>
|
||
8 years ago
|
<% if (isPending(judge.status) && judge.allowedSeeResult) { %>
|
||
8 years ago
|
document.addEventListener('mousedown', function (event) {
|
||
|
var list = $('#judge_detail_item').find('div.auto_update_activation');
|
||
|
for (var i = 0; i < list.length; ++i) {
|
||
|
$(list[i]).removeClass('auto_update_activation');
|
||
|
}
|
||
|
});
|
||
8 years ago
|
function update_submission() {
|
||
8 years ago
|
setTimeout(function () {
|
||
8 years ago
|
$.get('/submission/<%= judge.id %>/ajax', function (data) {
|
||
|
var e = $('#submission_content'), x = $($.parseHTML(data));
|
||
8 years ago
|
if (e.find('td.status').text().trim() != x.find('td.status').text().trim()) {
|
||
8 years ago
|
var a = e.find('div.auto_update');
|
||
8 years ago
|
if (!a.length) {
|
||
|
e.html(data);
|
||
|
} else {
|
||
|
e.find('#status_table').html(x.find('#status_table'));
|
||
8 years ago
|
var b = x.find('div.auto_update');
|
||
8 years ago
|
for (var i = 0; i < a.length; i++) {
|
||
|
a[i].innerHTML = b[i].innerHTML;
|
||
|
if (!$(b[i]).hasClass('pending')) $(a[i]).removeClass('pending');
|
||
|
if (!$(b[i]).attr('style')) $(a[i]).attr('style', '');
|
||
|
}
|
||
8 years ago
|
a = e.find('div.auto_update_activation');
|
||
|
b = x.find('div.auto_update_activation');
|
||
|
for (var i = 0; i < a.length; i++) {
|
||
|
if ($(b[i]).hasClass('active')) $(a[i]).addClass('active'); else $(a[i]).removeClass('active');
|
||
|
}
|
||
8 years ago
|
|
||
8 years ago
|
if (!x.find('#stop_ajax').length) update_submission();
|
||
8 years ago
|
}
|
||
|
}
|
||
8 years ago
|
else if (!x.find('#stop_ajax').length) update_submission();
|
||
8 years ago
|
});
|
||
|
}, 500);
|
||
|
}
|
||
8 years ago
|
update_submission();
|
||
8 years ago
|
<% } %>
|
||
8 years ago
|
</script>
|