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, judge_id: judge_state.id,
code: judge_state.code, code: judge_state.code,
language: judge_state.language, 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, time_limit: judge_state.problem.time_limit,
memory_limit: judge_state.problem.memory_limit, memory_limit: judge_state.problem.memory_limit,
file_io: judge_state.problem.file_io, file_io: judge_state.problem.file_io,

42
static/style.css

@ -47,26 +47,46 @@ th {
:not(.status_detail).status.runtime_error, :not(.status_detail).status.runtime_error,
.title:hover .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; color: darkorchid;
} }
:not(.status_detail).status.memory_limit_exceed, :not(.status_detail).status.memory_limit_exceeded,
.title:hover .status_detail.status.memory_limit_exceed, .title:hover .status_detail.status.memory_limit_exceeded,
.title.active .status_detail.status.memory_limit_exceed, .title.active .status_detail.status.memory_limit_exceeded,
:not(.status_detail).status.time_limit_exceed, :not(.status_detail).status.time_limit_exceeded,
.title:hover .status_detail.status.time_limit_exceed, .title:hover .status_detail.status.time_limit_exceeded,
.title.active .status_detail.status.time_limit_exceed, .title.active .status_detail.status.time_limit_exceeded,
:not(.status_detail).status.output_limit_exceed, :not(.status_detail).status.output_limit_exceeded,
.title:hover .status_detail.status.output_limit_exceed, .title:hover .status_detail.status.output_limit_exceeded,
.title.active .status_detail.status.output_limit_exceed { .title.active .status_detail.status.output_limit_exceeded {
color: sandybrown; 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; 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 { :not(.status_detail).status.compile_error {
color: rgb(0, 68, 136); 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> <!DOCTYPE html>
<html> <html>
<head> <head>

60
views/judge_detail.ejs

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

13
views/problem_set.ejs

@ -28,19 +28,6 @@
<% if (user) { %> <% if (user) { %>
<td> <td>
<% if (problem.judge_state) { %> <% 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]) %>"> <a href="<%= syzoj.utils.makeUrl(['judge_detail', problem.judge_state.id]) %>">
<span class="status <%= problem.judge_state.status.toLowerCase().split(' ').join('_') %>"> <span class="status <%= problem.judge_state.status.toLowerCase().split(' ').join('_') %>">
<i class="<%= icon[problem.judge_state.status] || 'remove' %> icon"></i> <i class="<%= icon[problem.judge_state.status] || 'remove' %> icon"></i>

Loading…
Cancel
Save