Browse Source

Fix code length in judge detail

pull/6/head
Menci 8 years ago
parent
commit
d96d2cac46
  1. 2
      modules/judge.js
  2. 2
      views/judge_detail_item.ejs

2
modules/judge.js

@ -75,6 +75,7 @@ app.get('/judge_detail/:id', async (req, res) => {
let id = parseInt(req.params.id); let id = parseInt(req.params.id);
let judge = await JudgeState.fromID(id); let judge = await JudgeState.fromID(id);
judge.codeLength = judge.code.length;
judge.code = await syzoj.utils.highlight(judge.code, syzoj.config.languages[judge.language].highlight); judge.code = await syzoj.utils.highlight(judge.code, syzoj.config.languages[judge.language].highlight);
if (judge.result.compiler_output) judge.result.compiler_output = syzoj.utils.ansiToHTML(judge.result.compiler_output); if (judge.result.compiler_output) judge.result.compiler_output = syzoj.utils.ansiToHTML(judge.result.compiler_output);
judge.allowedSeeResult = await judge.isAllowedSeeResultBy(res.locals.user); judge.allowedSeeResult = await judge.isAllowedSeeResultBy(res.locals.user);
@ -96,6 +97,7 @@ app.get('/judge_detail/:id/ajax', async (req, res) => {
let id = parseInt(req.params.id); let id = parseInt(req.params.id);
let judge = await JudgeState.fromID(id); let judge = await JudgeState.fromID(id);
judge.codeLength = judge.code.length;
judge.code = await syzoj.utils.highlight(judge.code, syzoj.config.languages[judge.language].highlight); judge.code = await syzoj.utils.highlight(judge.code, syzoj.config.languages[judge.language].highlight);
if (judge.result.compiler_output) judge.result.compiler_output = syzoj.utils.ansiToHTML(judge.result.compiler_output); if (judge.result.compiler_output) judge.result.compiler_output = syzoj.utils.ansiToHTML(judge.result.compiler_output);
judge.allowedSeeResult = await judge.isAllowedSeeResultBy(res.locals.user); judge.allowedSeeResult = await judge.isAllowedSeeResultBy(res.locals.user);

2
views/judge_detail_item.ejs

@ -25,7 +25,7 @@
<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>
<td><%= judge.result.total_time %> ms</td> <td><%= judge.result.total_time %> ms</td>
<td><%= judge.result.max_memory %> K</td> <td><%= judge.result.max_memory %> K</td>
<td><%= syzoj.config.languages[judge.language].show %> / <%= syzoj.utils.formatSize(judge.code.length) %></td> <td><%= syzoj.config.languages[judge.language].show %> / <%= syzoj.utils.formatSize(judge.codeLength) %></td>
<% } else { %> <% } else { %>
<td>隐藏</td> <td>隐藏</td>
<td>隐藏</td> <td>隐藏</td>

Loading…
Cancel
Save