Browse Source

增加最大单项耗时的显示

pull/6/head
richie 5 years ago
parent
commit
3657f0d7a0
  1. 9
      libs/submissions_process.js
  2. 1
      views/submission.ejs
  3. 3
      views/submissions_item.ejs

9
libs/submissions_process.js

@ -1,4 +1,5 @@
const {getCachedJudgeState} = require('./judger');
const _ = require('lodash');
const getSubmissionInfo = (s, displayConfig) => ({
submissionId: s.id,
@ -13,6 +14,12 @@ const getSubmissionInfo = (s, displayConfig) => ({
});
const getRoughResult = (x, displayConfig, roughOnly) => {
let max = 0;
_.forEach(x.result.judge.subtasks, function (item) {
_.forEach(item.cases, function (one) {
max = Math.max(max, one.result.time);
});
});
if (displayConfig.showResult) {
if (x.pending) {
let res = getCachedJudgeState(x.task_id) || null;
@ -22,6 +29,7 @@ const getRoughResult = (x, displayConfig, roughOnly) => {
return Object.assign({}, res, {
result: 'Judging',
time: 0,
maxItemTime: 0,
memory: 0,
score: 0
});
@ -30,6 +38,7 @@ const getRoughResult = (x, displayConfig, roughOnly) => {
return {
result: x.status,
time: displayConfig.showUsage ? x.total_time : null,
maxItemTime: displayConfig.showUsage ? max : null,
memory: displayConfig.showUsage ? x.max_memory : null,
score: displayConfig.showScore ? x.score : null
};

1
views/submission.ejs

@ -39,6 +39,7 @@
<th>状态</th>
<th v-if="displayConfig.showScore">分数</th>
<th v-if="displayConfig.showUsage">总时间</th>
<th v-if="displayConfig.showUsage">最大单项时间</th>
<th v-if="displayConfig.showUsage">内存</th>
<th v-if="displayConfig.showCode">代码 / 答案文件</th>
<th>提交者</th>

3
views/submissions_item.ejs

@ -88,6 +88,8 @@
<% } %>
<td v-if="config.showUsage">{{ (data.result.time || 0).toString() + ' ms' }}</td>
<td v-if="config.showUsage">{{ (data.result.maxItemTime || 0).toString() + ' ms' }}</td>
<% if (active === 'submissions') { %>
<td v-if="config.showUsage">{{ formatSize(data.result.memory * 1024, 2) }}</td>
<% } else { %>
@ -177,6 +179,7 @@
}
$('#modal-rejudge').modal('show');
}
function check_share() {
$('#modal-share').modal('show');
}

Loading…
Cancel
Save