Browse Source

Fix bug where skipped subtasks with NULL time & memory field cause total time to be NaN and fail to be written to database

pull/6/head
hewenyang 7 years ago
parent
commit
71605cb66f
  1. 4
      libs/judgeResult.js

4
libs/judgeResult.js

@ -47,8 +47,8 @@ function convertResult(taskId, source) {
else else
return reduce(list); return reduce(list);
}; };
time = forEveryTestcase(c => c.time, _.sum); time = forEveryTestcase(c => (c.time ? c.time : 0), _.sum);
memory = forEveryTestcase(c => c.memory, _.max); memory = forEveryTestcase(c => (c.memory ? c.memory : 0), _.max);
if (source.judge.subtasks.some(s => s.cases.some(c => c.status === interfaces.TaskStatus.Failed))) { if (source.judge.subtasks.some(s => s.cases.some(c => c.status === interfaces.TaskStatus.Failed))) {
winston.debug(`Some subtasks failed, returning system error`); winston.debug(`Some subtasks failed, returning system error`);
statusString = systemError; statusString = systemError;

Loading…
Cancel
Save