t123yh
7 years ago
13 changed files with 284 additions and 358 deletions
@ -0,0 +1,40 @@
|
||||
const getSubmissionInfo = (s, displayConfig) => ({ |
||||
taskId: s.id, |
||||
user: s.user.username, |
||||
userId: s.user_id, |
||||
problemName: s.problem.title, |
||||
problemId: s.problem_id, |
||||
language: displayConfig.hideCode ? null : ((s.language != null && s.language !== '') ? syzoj.config.languages[s.language].show : null), |
||||
codeSize: displayConfig.hideCode ? null : syzoj.utils.formatSize(s.code.length), |
||||
submitTime: syzoj.utils.formatDate(s.submit_time), |
||||
}); |
||||
|
||||
const getRoughResult = (x, displayConfig) => { |
||||
if (displayConfig.hideResult) { |
||||
// 0: Waiting 1: Running
|
||||
if (x.status === "System Error") |
||||
return { result: "System Error" }; |
||||
if (x.compilation == null || [0, 1].includes(x.compilation.status)) { |
||||
return null; |
||||
} else { |
||||
if (x.compilation.status === 2) { // 2 is TaskStatus.Done
|
||||
return { result: "Submitted" }; |
||||
} else { |
||||
return { result: "Compile Error" }; |
||||
} |
||||
} |
||||
} else { |
||||
if (x.pending) { |
||||
return null; |
||||
} else { |
||||
return { |
||||
result: x.status, |
||||
time: displayConfig.hideUsage ? null : x.total_time, |
||||
memory: displayConfig.hideUsage ? null : x.max_memory, |
||||
score: displayConfig.hideUsage ? null : x.score |
||||
}; |
||||
} |
||||
} |
||||
} |
||||
|
||||
module.exports = { getRoughResult, getSubmissionInfo }; |
@ -1,108 +0,0 @@
|
||||
<% this.title = '提交记录 - ' + contest.title %> |
||||
<% include header %> |
||||
<script src="/textFit.js"></script> |
||||
<div class="padding"> |
||||
<form action="<%= syzoj.utils.makeUrl(['contest', contest.id, 'submissions']) %>" class="ui mini form" method="get" role="form" id="form" onsubmit="return checkSubmit()"> |
||||
<div class="inline fields" style="margin-bottom: 25px; "> |
||||
<label style="font-size: 1.2em; margin-right: 1px; ">题目:</label> |
||||
<div class="field"><input id="problem_id" style="width: 50px; " type="text" value="<%= this.alpha(form.problem_id) %>"></div> |
||||
<input type="hidden" name="problem_id" id="problem_id_hidden"> |
||||
<label style="font-size: 1.2em; margin-right: 1px; ">提交者:</label> |
||||
<div class="field"><input name="submitter" style="width: 100px; " type="text" value="<%= form.submitter %>"></div> |
||||
<% if ((typeof contest === 'undefined' || !contest) || contest.ended || contest.type !== 'noi' || (user && user.is_admin)) { %> |
||||
<% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && (contest.type === 'acm' || contest.type === 'noi'))) { %> |
||||
<label style="font-size: 1.2em; margin-right: 1px; ">分数:</label> |
||||
<div class="field" style="padding-right: 6px; "><input name="min_score" style="width: 45px; " type="text" value="<%= form.min_score || 0 %>"></div> |
||||
<label style="font-size: 1.2em; margin-right: 7px; ">~</label> |
||||
<div class="field"><input name="max_score" style="width: 45px; " type="text" value="<%= form.max_score || 100 %>"></div> |
||||
<% } %> |
||||
<label style="font-size: 1.2em; margin-right: 1px; ">语言:</label> |
||||
<div class="field"> |
||||
<div class="ui fluid selection dropdown" id="select_language" style="width: 110px; "> |
||||
<input type="hidden" name="language" value="<%= form.language %>"> |
||||
<i class="dropdown icon"></i> |
||||
<div class="default text"></div> |
||||
<div class="menu"> |
||||
<div class="item" data-value="">不限</div> |
||||
<% for (let lang in syzoj.config.languages) { %> |
||||
<div class="item" data-value="<%= lang %>"><%= syzoj.config.languages[lang].show %></div> |
||||
<% } %> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<label style="font-size: 1.2em; margin-right: 1px; ">状态:</label> |
||||
<div class="field"> |
||||
<div class="ui fluid selection dropdown" id="select_status" style="width: 210px; "> |
||||
<input type="hidden" name="status" value="<%= form.status %>"> |
||||
<i class="dropdown icon"></i> |
||||
<div class="default text"></div> |
||||
<div class="menu"> |
||||
<div class="item" data-value="">不限<i class="dropdown icon" style="visibility: hidden; "></i></div> |
||||
<% for (let status in this.icon) { %> |
||||
<% if (this.iconHidden.includes(status)) continue; %> |
||||
<div class="item" data-value="<%= status %>"><span class="status <%= status.toLowerCase().split(' ').join('_') %>"><i class="<%= this.icon[status] %> icon"></i> <%= status %></div> |
||||
<% } %> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<% } %> |
||||
<button class="ui labeled icon mini button" type="submit"> |
||||
<i class="search icon"></i> |
||||
搜索 |
||||
</button> |
||||
<% if (user) { %> |
||||
<a class="ui mini labeled icon blue button" style="margin-left: auto; " id="my_submit"> |
||||
<i class="user icon"></i> |
||||
我的提交 |
||||
</a> |
||||
<script> |
||||
$(function () { |
||||
$('#my_submit').click(function () { |
||||
$('[name=submitter]').val(<%- JSON.stringify(user.username) %>); |
||||
$('#form').submit(); |
||||
}); |
||||
}); |
||||
</script> |
||||
<% } %> |
||||
</div> |
||||
</form> |
||||
<table class="ui very basic center aligned table" style="white-space: nowrap; "> |
||||
<thead> |
||||
<tr> |
||||
<th>编号</th> |
||||
<th>题目</th> |
||||
<th>状态</th> |
||||
<% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && (contest.type === 'acm' || contest.type === 'noi'))) { %> |
||||
<th>分数</th> |
||||
<% } %> |
||||
<th>总时间</th> |
||||
<th>内存</th> |
||||
<th>代码</th> |
||||
<th>提交者</th> |
||||
<th>提交时间</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<% for (let judge of judge_state) { %> |
||||
<tr id="submissions_<%= judge.id %>"><% include submissions_item %></tr> |
||||
<% } %> |
||||
</tbody> |
||||
</table> |
||||
<br> |
||||
<% include page %> |
||||
</div> |
||||
<script> |
||||
$(function () { |
||||
$('#select_language').dropdown(); |
||||
$('#select_status').dropdown(); |
||||
}); |
||||
|
||||
function checkSubmit() { |
||||
var x = $('#problem_id').val(), ch = x.charCodeAt(0); |
||||
if (x.length === 1 && x >= 'A' && x <= 'Z') $('#problem_id_hidden').val(ch - 'A'.charCodeAt(0) + 1); |
||||
else if (x.length === 1 && x >= 'a' && x <= 'a') $('#problem_id_hidden').val(ch - 'a'.charCodeAt(0) + 1); |
||||
else $('#problem_id_hidden').val(x); |
||||
return true; |
||||
} |
||||
</script> |
||||
<% include footer %> |
Loading…
Reference in new issue