Browse Source

Fix see time and memory in NOI contest

pull/6/head
Menci 7 years ago
parent
commit
0f86a5e95a
  1. 4
      README.md
  2. 8
      modules/submission.js
  3. 16
      views/submission_content.ejs
  4. 24
      views/submissions_item.ejs

4
README.md

@ -12,9 +12,9 @@ git clone https://github.com/syzoj/syzoj
cd syzoj
```
Install dependencies with `npm install` or `yarn`.
Install dependencies with `npm install` or `yarn`. Also, follow the instructions [here](https://www.npmjs.com/package/node-7z#installation) to install `7z` executable used by the `node-7z` package.
Copy the `config-example.json` file to `config.json`, and change the configures.
Copy `config-example.json` to `config.json`, and make necessary changes.
## Database
SYZOJ 2 uses [Sequelize](http://sequelizejs.com), which supports many database systems, including MySQL and Sqlite.

8
modules/submission.js

@ -149,6 +149,7 @@ app.get('/submission/:id', async (req, res) => {
judge.allowedRejudge = await judge.problem.isAllowedEditBy(res.locals.user);
judge.allowedManage = await judge.problem.isAllowedManageBy(res.locals.user);
let hideScore = false;
if (contest) {
let problems_id = await contest.getProblems();
judge.problem_id = problems_id.indexOf(judge.problem_id) + 1;
@ -158,10 +159,13 @@ app.get('/submission/:id', async (req, res) => {
if (!['Compile Error', 'Waiting', 'Compiling'].includes(judge.status)) {
judge.status = 'Submitted';
}
hideScore = true;
}
}
res.render('submission', {
hideScore, hideScore,
contest: contest,
judge: judge
});
@ -197,6 +201,7 @@ app.get('/submission/:id/ajax', async (req, res) => {
judge.allowedRejudge = await judge.problem.isAllowedEditBy(res.locals.user);
judge.allowedManage = await judge.problem.isAllowedManageBy(res.locals.user);
let hideScore = false;
if (contest) {
let problems_id = await contest.getProblems();
judge.problem_id = problems_id.indexOf(judge.problem_id) + 1;
@ -206,10 +211,13 @@ app.get('/submission/:id/ajax', async (req, res) => {
if (!['Compile Error', 'Waiting', 'Compiling'].includes(judge.status)) {
judge.status = 'Submitted';
}
hideScore = true;
}
}
res.render('submission_content', {
hideScore, hideScore,
contest: contest,
judge: judge
});

16
views/submission_content.ejs

@ -36,12 +36,14 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]);
<th>编号</th>
<th>题目名称</th>
<th>状态</th>
<% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && (contest.type === 'acm' || contest.type === 'noi'))) { %>
<% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && contest.type === 'acm') && !hideScore) { %>
<th>分数</th>
<% } %>
<% if (judge.problem.type !== 'submit-answer') { %>
<th>总时间</th>
<th>内存</th>
<% if (!hideScore) { %>
<th>总时间</th>
<th>内存</th>
<% } %>
<th>代码</th>
<% } else { %>
<th>文件大小</th>
@ -58,12 +60,14 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]);
<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' || contest.type === 'noi'))) { %>
<% 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') { %>
<td><%= judge.result.total_time %> ms</td>
<td><%= parseInt(judge.result.max_memory) || 0 %> K</td>
<% 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 { %>

24
views/submissions_item.ejs

@ -18,18 +18,18 @@ textFit(e, { maxFontSize: 14 });
</a></td>
<% if ((typeof contest === 'undefined' || !contest) || !((!user || !user.is_admin) && !contest.ended && (contest.type === 'acm' || contest.type === 'noi'))) { %>
<td><a href="<%= syzoj.utils.makeUrl(['submission', judge.id]) %>"><span class="score score_<%= parseInt(judge.result.score / 10) || 0 %>"><%= judge.result.score %></span></a></td>
<% } %>
<% if (judge.problem.type !== 'submit-answer') { %>
<td><%= judge.result.total_time %> ms</td>
<td><%= parseInt(judge.result.max_memory) || 0 %> K</td>
<% if (judge.allowedSeeCode) { %>
<td><a href="<%= syzoj.utils.makeUrl(['submission', judge.id]) %>"><%= syzoj.config.languages[judge.language].show %></a> / <%= syzoj.utils.formatSize(judge.code.length) %></td>
<% } else { %>
<td><a href="<%= syzoj.utils.makeUrl(['submission', judge.id]) %>"><%= syzoj.config.languages[judge.language].show %></a> / 隐藏</td>
<% } %>
<% } else { %>
<td>-</td><td>-</td>
<td><%= syzoj.utils.formatSize(judge.max_memory) %></td>
<% if (judge.problem.type !== 'submit-answer') { %>
<td><%= judge.result.total_time %> ms</td>
<td><%= parseInt(judge.result.max_memory) || 0 %> K</td>
<% if (judge.allowedSeeCode) { %>
<td><a href="<%= syzoj.utils.makeUrl(['submission', judge.id]) %>"><%= syzoj.config.languages[judge.language].show %></a> / <%= syzoj.utils.formatSize(judge.code.length) %></td>
<% } else { %>
<td><a href="<%= syzoj.utils.makeUrl(['submission', judge.id]) %>"><%= syzoj.config.languages[judge.language].show %></a> / 隐藏</td>
<% } %>
<% } else { %>
<td>-</td><td>-</td>
<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) %>

Loading…
Cancel
Save