Browse Source

NPE

pull/6/head
richie 5 years ago
parent
commit
1b5580386c
  1. 12
      libs/submissions_process.js

12
libs/submissions_process.js

@ -15,11 +15,13 @@ const getSubmissionInfo = (s, displayConfig) => ({
const getRoughResult = (x, displayConfig, roughOnly) => { const getRoughResult = (x, displayConfig, roughOnly) => {
let max = 0; let max = 0;
_.forEach(x.result.judge.subtasks, function (item) { if (x.result.judge) {
_.forEach(item.cases, function (one) { _.forEach(x.result.judge.subtasks, function (item) {
max = Math.max(max, one.result.time); _.forEach(item.cases, function (one) {
max = Math.max(max, one.result.time);
});
}); });
}); }
if (displayConfig.showResult) { if (displayConfig.showResult) {
if (x.pending) { if (x.pending) {
let res = getCachedJudgeState(x.task_id) || null; let res = getCachedJudgeState(x.task_id) || null;
@ -38,7 +40,7 @@ const getRoughResult = (x, displayConfig, roughOnly) => {
return { return {
result: x.status, result: x.status,
time: displayConfig.showUsage ? x.total_time : null, time: displayConfig.showUsage ? x.total_time : null,
maxItemTime: displayConfig.showUsage ? max : null, maxItemTime: displayConfig.showUsage ? max === 0 ? x.total_time : max : null,
memory: displayConfig.showUsage ? x.max_memory : null, memory: displayConfig.showUsage ? x.max_memory : null,
score: displayConfig.showScore ? x.score : null score: displayConfig.showScore ? x.score : null
}; };

Loading…
Cancel
Save