Browse Source

Fix problem page

pull/6/head
Menci 8 years ago
parent
commit
5917369583
  1. 4
      modules/contest.js
  2. 22
      views/problem.ejs

4
modules/contest.js

@ -346,13 +346,15 @@ app.get('/contest/:id/:pid', async (req, res) => {
await syzoj.utils.markdown(problem, [ 'description', 'input_format', 'output_format', 'example', 'limit_and_hint' ]); await syzoj.utils.markdown(problem, [ 'description', 'input_format', 'output_format', 'example', 'limit_and_hint' ]);
let state = await problem.getJudgeState(res.locals.user, false); let state = await problem.getJudgeState(res.locals.user, false);
let testcases = await syzoj.utils.parseTestdata(problem.getTestdataPath(), problem.type === 'submit-answer');
res.render('problem', { res.render('problem', {
pid: pid, pid: pid,
contest: contest, contest: contest,
problem: problem, problem: problem,
state: state, state: state,
lastLanguage: res.locals.user ? await res.locals.user.getLastSubmitLanguage() : null lastLanguage: res.locals.user ? await res.locals.user.getLastSubmitLanguage() : null,
testcases: testcases
}); });
} catch (e) { } catch (e) {
syzoj.log(e); syzoj.log(e);

22
views/problem.ejs

@ -1,3 +1,4 @@
<% include util %>
<% <%
if (typeof contest === 'undefined') contest = null; if (typeof contest === 'undefined') contest = null;
if (contest) { if (contest) {
@ -29,20 +30,7 @@ if (contest) {
<% } %> <% } %>
</h1> </h1>
</div> </div>
<% if (contest) { %> <% if (problem.type !== 'submit-answer') { %>
<div class="row" style="margin-top: -15px">
<span class="ui label">内存限制:<%= problem.memory_limit %> MiB</span>
<span class="ui label">时间限制:<%= problem.time_limit %> ms</span>
</div>
<div class="row" style="margin-top: -23px">
<% if (problem.file_io) { %>
<span class="ui label">输入文件:<%= problem.file_io_input_name %></span>
<span class="ui label">输出文件:<%= problem.file_io_output_name %></span>
<% } else { %>
<span class="ui label">标准输入输出</span>
<% } %>
</div>
<% } else { %>
<div class="row" style="margin-top: -15px"> <div class="row" style="margin-top: -15px">
<span class="ui label">内存限制:<%= problem.memory_limit %> MiB</span> <span class="ui label">内存限制:<%= problem.memory_limit %> MiB</span>
<span class="ui label">时间限制:<%= problem.time_limit %> ms</span> <span class="ui label">时间限制:<%= problem.time_limit %> ms</span>
@ -53,10 +41,12 @@ if (contest) {
<span class="ui label">标准输入输出</span> <span class="ui label">标准输入输出</span>
<% } %> <% } %>
</div> </div>
<div class="row" style="margin-top: -23px"> <% } %>
<span class="ui label">评测方式:<%= (testcases && !testcases.error) ? (testcases.spj ? 'Special Judge' : '文本比较') : '无测试数据' %></span> <div class="row" style="margin-top: -<%= problem.type === 'submit-answer' ? 15 : 23 %>px">
<span class="ui label">题目类型:<%= { 'submit-answer': '答案提交', 'interaction': '交互', 'traditional': '传统' }[problem.type] %></span> <span class="ui label">题目类型:<%= { 'submit-answer': '答案提交', 'interaction': '交互', 'traditional': '传统' }[problem.type] %></span>
<span class="ui label">评测方式:<%= (testcases && !testcases.error) ? (testcases.spj ? 'Special Judge' : '文本比较') : '无测试数据' %></span>
</div> </div>
<% if (!contest) { %>
<div class="row" style="margin-top: -23px"> <div class="row" style="margin-top: -23px">
<span class="ui label">上传者: <span class="ui label">上传者:
<% if (problem.is_anonymous && !problem.allowedManage) { %> <% if (problem.is_anonymous && !problem.allowedManage) { %>

Loading…
Cancel
Save