t123yh
7 years ago
9 changed files with 4179 additions and 352 deletions
@ -1,286 +1,5 @@ |
|||||||
<% include util %> |
<% include util %> |
||||||
<% |
|
||||||
// Sanitize judge results for backward compatibility and clarity |
|
||||||
if (!judge.result.subtasks) { |
|
||||||
judge.result.subtasks = [ |
|
||||||
{ case_num: judge.result.case_num, status: judge.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' |
|
||||||
}; |
|
||||||
if (!runningFound) s.isActiveSubtask = true; |
|
||||||
runningFound = true; |
|
||||||
} |
|
||||||
} |
|
||||||
%> |
|
||||||
|
|
||||||
<% |
<script src="https://cdn.bootcss.com/vue/2.4.2/vue.min.js"></script> |
||||||
let problemUrl; |
<script src="https://cdn.bootcss.com/socket.io/2.0.3/socket.io.js"></script> |
||||||
if (typeof contest !== 'undefined') problemUrl = syzoj.utils.makeUrl(['contest', contest.id, judge.problem_id]); |
<script src="https://cdn.bootcss.com/jsondiffpatch/0.2.4/jsondiffpatch.js"></script> |
||||||
else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]); |
|
||||||
%> |
|
||||||
|
|
||||||
<div class="padding"> |
|
||||||
<table class="ui very basic center aligned table" id="status_table" style="visibility: hidden; "> |
|
||||||
<thead> |
|
||||||
<tr> |
|
||||||
<th>编号</th> |
|
||||||
<th>题目名称</th> |
|
||||||
<th>状态</th> |
|
||||||
<% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && contest.type === 'acm') && !hideScore) { %> |
|
||||||
<th>分数</th> |
|
||||||
<% } %> |
|
||||||
<% if (judge.problem.type !== 'submit-answer') { %> |
|
||||||
<% if (!hideScore) { %> |
|
||||||
<th>总时间</th> |
|
||||||
<th>内存</th> |
|
||||||
<% } %> |
|
||||||
<th>代码</th> |
|
||||||
<% } else { %> |
|
||||||
<th>文件大小</th> |
|
||||||
<% } %> |
|
||||||
<th>提交者</th> |
|
||||||
<th>提交时间</th> |
|
||||||
<% if (judge.allowedRejudge) { %> |
|
||||||
<th>重新评测</th> |
|
||||||
<% } %> |
|
||||||
</tr> |
|
||||||
</thead> |
|
||||||
<tbody> |
|
||||||
<tr> |
|
||||||
<td>#<%= judge.id %></td> |
|
||||||
<td><a style="width: 230px; height: 22px; display: block; margin: 0 auto; line-height: 22px; " id="text-fit" href="<%= problemUrl %>"><%= (typeof contest !== 'undefined' && contest) ? this.alpha(judge.problem_id) : ('#' + judge.problem_id) %>. <%= judge.problem.title %></a></td> |
|
||||||
<td class="status <%= getStatusMeta(judge.status).toLowerCase().split(' ').join('_') %>"> |
|
||||||
<i class="<%= icon[getStatusMeta(judge.status)] || 'remove' %> icon"></i> |
|
||||||
<%= judge.status %> |
|
||||||
</td> |
|
||||||
<% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && contest.type === 'acm') && !hideScore) { %> |
|
||||||
<td class="score score_<%= parseInt(judge.result.score / 10) || 0 %>"><%= judge.result.score %></td> |
|
||||||
<% } %> |
|
||||||
<% if (judge.problem.type !== 'submit-answer') { %> |
|
||||||
<% if (!hideScore) { %> |
|
||||||
<td><%= judge.result.total_time %> ms</td> |
|
||||||
<td><%= parseInt(judge.result.max_memory) || 0 %> K</td> |
|
||||||
<% } %> |
|
||||||
<% if (judge.allowedSeeCode) { %> |
|
||||||
<td><%= syzoj.config.languages[judge.language].show %> / <%= syzoj.utils.formatSize(judge.codeLength) %></td> |
|
||||||
<% } else { %> |
|
||||||
<td><%= syzoj.config.languages[judge.language].show %> / 隐藏 %></td> |
|
||||||
<% } %> |
|
||||||
<% } else { %> |
|
||||||
<td><%= syzoj.utils.formatSize(judge.max_memory) %></td> |
|
||||||
<% } %> |
|
||||||
<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> |
|
||||||
<% if (judge.allowedRejudge) { %> |
|
||||||
<td> |
|
||||||
<a id="rejudge-button" onclick="check_rejudge()" style="color: #000; " href="#"><i class="repeat icon"></i></a> |
|
||||||
<div class="ui basic modal" id="modal-rejudge"> |
|
||||||
<div class="ui icon header"> |
|
||||||
<i class="retweet icon"></i> |
|
||||||
<p style="margin-top: 15px; ">重新评测</p> |
|
||||||
</div> |
|
||||||
<div class="content" style="text-align: center; "> |
|
||||||
<p>确认重新评测该提交记录吗?</p> |
|
||||||
<p id="warning_pending"><strong>警告:只有管理员可以重新评测一个未评测完成的记录,<br>这种情况一般发生在评测服务中断后,如果一个提交正在被评测,<br>则将其重新评测会导致系统错乱!</strong></p> |
|
||||||
<script> |
|
||||||
var pending = <%= judge.pending %>; |
|
||||||
function check_rejudge() { |
|
||||||
if (pending) { |
|
||||||
$('#warning_pending').css('display', ''); |
|
||||||
} else { |
|
||||||
$('#warning_pending').css('display', 'none'); |
|
||||||
} |
|
||||||
$('#modal-rejudge').modal('show'); |
|
||||||
} |
|
||||||
</script> |
|
||||||
</div> |
|
||||||
<div class="actions"> |
|
||||||
<div class="ui red basic cancel inverted button"> |
|
||||||
<i class="remove icon"></i> |
|
||||||
否 |
|
||||||
</div> |
|
||||||
<a class="ui green ok inverted button" href-post="<%= syzoj.utils.makeUrl(['submission', judge.id, 'rejudge']) %>"> |
|
||||||
<i class="checkmark icon"></i> |
|
||||||
是 |
|
||||||
</a> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</td> |
|
||||||
<% } %> |
|
||||||
</tr> |
|
||||||
</tbody> |
|
||||||
</table> |
|
||||||
<script> |
|
||||||
window.applyTextFit = function () { |
|
||||||
var e = document.getElementById('text-fit'); |
|
||||||
textFit(e, { maxFontSize: 14 }); |
|
||||||
document.getElementById('status_table').style.visibility = ''; |
|
||||||
} |
|
||||||
window.applyTextFit(); |
|
||||||
</script> |
|
||||||
<% if (judge.problem.type !== 'submit-answer' && judge.allowedSeeCode) { %> |
|
||||||
<div class="ui existing segment" style="position: relative; "> |
|
||||||
<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> |
|
||||||
<% } %> |
|
||||||
<% if (judge.problem.type !== 'submit-answer' && judge.result.compiler_output && judge.status === 'Compile Error' && judge.allowedSeeCode) { %> |
|
||||||
<h3 class="ui header">编译信息</h3> |
|
||||||
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%- syzoj.utils.ansiToHTML(judge.result.compiler_output) %></code></pre></div> |
|
||||||
<% } else if (judge.result.message) { %> |
|
||||||
<h3 class="ui header">系统调试信息</h3> |
|
||||||
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%= judge.result.message %></code></pre></div> |
|
||||||
<% } else if (judge.result.spj_compiler_output) { %> |
|
||||||
<h3 class="ui header"><%= judge.problem.type === 'interaction' ? '交互程序' : 'Special Judge ' %>编译信息</h3> |
|
||||||
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%- syzoj.utils.ansiToHTML(judge.result.spj_compiler_output) %></code></pre></div> |
|
||||||
<% } else if (judge.allowedSeeCase && judge.result.subtasks && (judge.result.subtasks.length !== 1 || judge.result.subtasks[0].case_num)) { %> |
|
||||||
<div class="ui styled fluid accordion" id="subtasks_list"> |
|
||||||
<% let subtask_count = 0; %> |
|
||||||
<% for (let subtask_cases of (judge.result.subtasks || [])) { %> |
|
||||||
<% if (judge.result.subtasks.length !== 1) { %> |
|
||||||
<div class="title auto_update auto_update_activation<% if (subtask_cases.isActiveSubtask) { %> active<% } %>"> |
|
||||||
<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> |
|
||||||
<div class="content auto_update_activation<% if (subtask_cases.isActiveSubtask) { %> active<% } %>"> |
|
||||||
<div class="accordion" style="margin-top: 0; "> |
|
||||||
<% } %> |
|
||||||
<% for (let i = 0; i < subtask_cases.case_num; i++) { %> |
|
||||||
<% let testcase = subtask_cases[i]; %> |
|
||||||
<div class="title<% if (testcase.pending || !judge.allowedSeeData || testcase.status === 'Skipped') { %> pending<% } %> auto_update"<% if (testcase.pending || !judge.allowedSeeData) { %> style="cursor: auto; "<% } %>> |
|
||||||
<div class="ui grid"> |
|
||||||
<div class="<%= judge.problem.type === 'submit-answer' ? 'four' : '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 && testcase.status !== 'Skipped') { %> |
|
||||||
<% if (!testcase.score) testcase.score = testcase.status === 'Accepted' ? 100 : 0; %> |
|
||||||
<% if (judge.problem.type === 'submit-answer') { %> |
|
||||||
<% if (testcase.length != null) { %> |
|
||||||
<div class="three wide column">文件大小:<span style="font-weight: normal; "><%= syzoj.utils.formatSize(testcase.length) %></span></div> |
|
||||||
<% } %> |
|
||||||
<% } else { %> |
|
||||||
<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> |
|
||||||
<div class="content auto_update"> |
|
||||||
<% if (!testcase.pending && judge.allowedSeeData && testcase.status !== 'Skipped') { %> |
|
||||||
<p> |
|
||||||
<strong>输入文件<% if (testcase.input_file_name) { %>(<span style="font-family: monospace; "><%= testcase.input_file_name %></span>)<% } %></strong> |
|
||||||
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%= testcase.input %></code></pre></div> |
|
||||||
<% if (judge.problem.type !== 'interaction') { %> |
|
||||||
<strong>输出文件<% if (testcase.output_file_name) { %>(<span style="font-family: monospace; "><%= testcase.output_file_name %></span>)<% } %></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><%= judge.problem.type === 'interaction' ? '交互程序' : 'Special Judge ' %>信息</strong> |
|
||||||
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%= testcase.spj_message %></code></pre></div> |
|
||||||
<% } %> |
|
||||||
<% if (testcase.user_err) { %> |
|
||||||
<strong>标准错误</strong> |
|
||||||
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%= testcase.user_err %></code></pre></div> |
|
||||||
<% } %> |
|
||||||
<% if (testcase.runner_message && judge.allowedManage) { %> |
|
||||||
<strong>调试信息</strong> |
|
||||||
<div class="ui existing segment"><pre style="margin-top: 0; margin-bottom: 0; "><code><%= testcase.runner_message %></code></pre></div> |
|
||||||
<% } %> |
|
||||||
</p> |
|
||||||
<% } %> |
|
||||||
</div> |
|
||||||
<% } %> |
|
||||||
<% if (judge.result.subtasks.length !== 1) { %> |
|
||||||
</div></div> |
|
||||||
<% } %> |
|
||||||
<% } %> |
|
||||||
</div> |
|
||||||
<% } %> |
|
||||||
</div> |
|
||||||
|
|
||||||
<script> |
|
||||||
$(function() { |
|
||||||
$('.ui.accordion').accordion({ |
|
||||||
selector: { |
|
||||||
trigger: '.title:not(.pending)' |
|
||||||
} |
|
||||||
}); |
|
||||||
}); |
|
||||||
</script> |
|
||||||
|
|
||||||
<% if (!isPending(judge.status)) { %><div><div id="not_pending"></div></div><% } %> |
|
||||||
<script> |
|
||||||
<% if (isPending(judge.status)) { %> |
|
||||||
document.addEventListener('mousedown', function (event) { |
|
||||||
var list = $('#submission_content').find('div.auto_update_activation'); |
|
||||||
for (var i = 0; i < list.length; ++i) { |
|
||||||
$(list[i]).removeClass('auto_update_activation'); |
|
||||||
} |
|
||||||
}); |
|
||||||
function update_submission() { |
|
||||||
setTimeout(function () { |
|
||||||
$.get('/submission/<%= judge.id %>/ajax', function (data) { |
|
||||||
var e = $('#submission_content'), x = $($.parseHTML(data)); |
|
||||||
if (e.find('td.status').text().trim() != x.find('td.status').text().trim()) { |
|
||||||
var a = e.find('div.auto_update'); |
|
||||||
if (!a.length) { |
|
||||||
e.html(data); |
|
||||||
window.applyTextFit(); |
|
||||||
} else { |
|
||||||
e.find('#status_table').html(x.find('#status_table').html()); |
|
||||||
var b = x.find('div.auto_update'); |
|
||||||
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', ''); |
|
||||||
} |
|
||||||
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'); |
|
||||||
} |
|
||||||
|
|
||||||
window.applyTextFit(); |
|
||||||
if (!x.find('#not_pending').length) update_submission(); |
|
||||||
else pending = false; |
|
||||||
} |
|
||||||
} |
|
||||||
else if (!x.find('#not_pending').length) update_submission(); |
|
||||||
}); |
|
||||||
}, 500); |
|
||||||
} |
|
||||||
update_submission(); |
|
||||||
<% } %> |
|
||||||
</script> |
|
Loading…
Reference in new issue