Browse Source

Adapt the new judger

pull/6/head
Menci 8 years ago
parent
commit
7baf280c50
  1. 2
      modules/api.js
  2. 42
      static/style.css
  3. 22
      views/header.ejs
  4. 60
      views/judge_detail.ejs
  5. 17
      views/judge_state.ejs
  6. 13
      views/problem_set.ejs

2
modules/api.js

@ -132,7 +132,7 @@ app.get('/api/waiting_judge', async (req, res) => {
judge_id: judge_state.id,
code: judge_state.code,
language: judge_state.language,
testdata: judge_state.problem.testdata.md5,
testdata: judge_state.problem.testdata ? judge_state.problem.testdata.md5 : '',
time_limit: judge_state.problem.time_limit,
memory_limit: judge_state.problem.memory_limit,
file_io: judge_state.problem.file_io,

42
static/style.css

@ -47,26 +47,46 @@ th {
:not(.status_detail).status.runtime_error,
.title:hover .status_detail.status.runtime_error,
.title.active .status_detail.status.runtime_error {
.title.active .status_detail.status.runtime_error,
:not(.status_detail).status.file_error,
.title:hover .status_detail.status.file_error,
.title.active .status_detail.status.file_error {
color: darkorchid;
}
:not(.status_detail).status.memory_limit_exceed,
.title:hover .status_detail.status.memory_limit_exceed,
.title.active .status_detail.status.memory_limit_exceed,
:not(.status_detail).status.time_limit_exceed,
.title:hover .status_detail.status.time_limit_exceed,
.title.active .status_detail.status.time_limit_exceed,
:not(.status_detail).status.output_limit_exceed,
.title:hover .status_detail.status.output_limit_exceed,
.title.active .status_detail.status.output_limit_exceed {
:not(.status_detail).status.memory_limit_exceeded,
.title:hover .status_detail.status.memory_limit_exceeded,
.title.active .status_detail.status.memory_limit_exceeded,
:not(.status_detail).status.time_limit_exceeded,
.title:hover .status_detail.status.time_limit_exceeded,
.title.active .status_detail.status.time_limit_exceeded,
:not(.status_detail).status.output_limit_exceeded,
.title:hover .status_detail.status.output_limit_exceeded,
.title.active .status_detail.status.output_limit_exceeded {
color: sandybrown;
}
:not(.status_detail).status.waiting, :not(.status_detail).status.system_error {
:not(.status_detail).status.waiting,
.title:hover .status_detail.status.waiting,
.title.active .status_detail.status.waiting,
:not(.status_detail).status.system_error {
color: grey;
}
:not(.status_detail).status.running,
.title:hover .status_detail.status.running,
.title.active .status_detail.status.running {
color: #6cf;
}
:not(.status_detail).status.compiling {
color: #00b5ad;
}
:not(.status_detail).status.no_testdata {
color: brown;
}
:not(.status_detail).status.compile_error {
color: rgb(0, 68, 136);
}

22
views/header.ejs

@ -1,3 +1,25 @@
<%
this.getStatusMeta = (status) => {
if (status.startsWith('Running')) return 'Running';
else return status;
}
this.icon = {
'Accepted': 'checkmark',
'Wrong Answer': 'remove',
'Runtime Error': 'bomb',
'Time Limit Exceeded': 'clock',
'Memory Limit Exceeded': 'disk outline',
'Output Limit Exceeded': 'print',
'File Error': 'file outline',
'Waiting': 'hourglass half',
'Running': 'spinner',
'Compiling': 'spinner',
'Compile Error': 'code',
'System Error': 'server',
'No Testdata': 'folder open outline'
}
%>
<!DOCTYPE html>
<html>
<head>

60
views/judge_detail.ejs

@ -18,21 +18,8 @@
<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 <%= judge.result.status.toLowerCase().split(' ').join('_') %>">
<%
let icon = {
'Accepted': 'checkmark',
'Wrong Answer': 'remove',
'Runtime Error': 'bomb',
'Time Limit Exceed': 'clock',
'Memory Limit Exceed': 'disk outline',
'Output Limit Exceed': 'expand',
'Waiting': 'spinner',
'Compile Error': 'code',
'System Error': 'server'
}
%>
<i class="<%= icon[judge.status] || 'remove' %> icon"></i>
<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>
@ -56,30 +43,34 @@
<% } else if (judge.allowedSeeResult) { %>
<div class="ui styled fluid accordion">
<% for (let i = 0; i < judge.result.case_num; i++) { %>
<% let testcase = judge.result[i]; %>
<div class="title">
<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 <%= testcase.status.toLowerCase().split(' ').join('_') %>">
<%
let icon = {
'Accepted': 'checkmark',
'Wrong Answer': 'remove',
'Runtime Error': 'bomb',
'Time Limit Exceed': 'clock',
'Memory Limit Exceed': 'disk outline',
'Output Limit Exceed': 'expand',
'Waiting': 'spinner',
'Compile Error': 'code',
'System Error': 'server'
let testcase = judge.result[i], pending = false;
if (!testcase) {
pending = true;
if (i == 0 || judge.result[i - 1]) {
testcase = {
status: 'Running'
};
} else {
testcase = {
status: 'Waiting'
};
}
}
%>
<i class="<%= icon[testcase.status] || 'remove' %> icon"></i>
<div class="title<% if (pending) { %> pending<% } %>"<% if (pending) { %> style="cursor: auto; "<% } %>>
<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 (!pending) { %>
<div class="four wide column">用时:<span style="font-weight: normal; "><%= testcase.time_used %> ms</span></div>
<div class="four wide column">内存:<span style="font-weight: normal; "><%= testcase.memory_used %> KiB</span></div>
<% } %>
</div>
</div>
<% if (!pending) { %>
<div class="content">
<p>
<strong>输入文件</strong>
@ -91,12 +82,17 @@
</p>
</div>
<% } %>
<% } %>
</div>
<% } %>
<script>
$(function() {
$('.ui.accordion').accordion();
$('.ui.accordion').accordion({
selector: {
trigger: '.title:not(.pending)'
}
});
});
</script>
<% include footer %>

17
views/judge_state.ejs

@ -35,21 +35,8 @@
<td><a href="<%= syzoj.utils.makeUrl(['problem', judge.problem_id]) %>">#<%= judge.problem_id %>. <%= judge.problem.title %></a></td>
<% if (!judge.hidden) { %>
<td><a href="<%= syzoj.utils.makeUrl(['judge_detail', judge.id]) %>">
<span class="status <%= judge.status.toLowerCase().split(' ').join('_') %>">
<%
let icon = {
'Accepted': 'checkmark',
'Wrong Answer': 'remove',
'Runtime Error': 'bomb',
'Time Limit Exceed': 'clock',
'Memory Limit Exceed': 'disk outline',
'Output Limit Exceed': 'expand',
'Waiting': 'spinner',
'Compile Error': 'code',
'System Error': 'server'
}
%>
<i class="<%= icon[judge.status] || 'remove' %> icon"></i>
<span class="status <%= getStatusMeta(judge.status).toLowerCase().split(' ').join('_') %>">
<i class="<%= icon[getStatusMeta(judge.status)] || 'remove' %> icon"></i>
<%= judge.status %>
</span>
</a></td>

13
views/problem_set.ejs

@ -28,19 +28,6 @@
<% if (user) { %>
<td>
<% if (problem.judge_state) { %>
<%
let icon = {
'Accepted': 'checkmark',
'Wrong Answer': 'remove',
'Runtime Error': 'bomb',
'Time Limit Exceed': 'clock',
'Memory Limit Exceed': 'disk outline',
'Output Limit Exceed': 'expand',
'Waiting': 'spinner',
'Compile Error': 'code',
'System Error': 'server'
}
%>
<a href="<%= syzoj.utils.makeUrl(['judge_detail', problem.judge_state.id]) %>">
<span class="status <%= problem.judge_state.status.toLowerCase().split(' ').join('_') %>">
<i class="<%= icon[problem.judge_state.status] || 'remove' %> icon"></i>

Loading…
Cancel
Save