Browse Source

feat:代码健壮性完善。

feature/unlimited-reply
zjz1993 5 years ago
parent
commit
7fc808b2e9
  1. 2
      views/submission.ejs
  2. 4
      views/submission_contest.ejs

2
views/submission.ejs

@ -352,7 +352,7 @@ if (token != null) {
socket.emit('join', token, function (data) { socket.emit('join', token, function (data) {
console.log("join! ", data); console.log("join! ", data);
if (data && data.ok) { if (data && data.ok) {
if (data.finished && data.result && data.result.judge) { if (data.finished && data.result && data.result.judge && data.result.judge.subtasks) {
let max=0; let max=0;
data.result.judge.subtasks.forEach(function (item) { data.result.judge.subtasks.forEach(function (item) {
item.cases.forEach(function (one) { item.cases.forEach(function (one) {

4
views/submission_contest.ejs

@ -337,7 +337,7 @@ if (token != null) {
socket.on('finish', function (p) { socket.on('finish', function (p) {
console.log("Judge finished"); console.log("Judge finished");
let max=0; let max=0;
if (p && p.result && p.result.judge) { if (p && p.result && p.result.judge && p.result.judge.subtasks) {
p.result.judge.subtasks.forEach(function (item) { p.result.judge.subtasks.forEach(function (item) {
item.cases.forEach(function (one) { item.cases.forEach(function (one) {
max = one.result.time max = one.result.time
@ -353,7 +353,7 @@ if (token != null) {
socket.emit('join', token, function (data) { socket.emit('join', token, function (data) {
console.log("join! ", data); console.log("join! ", data);
if (data && data.ok) { if (data && data.ok) {
if (data.finished && data.result && data.result.judge) { if (data.finished && data.result && data.result.judge && data.result.judge.subtasks) {
let max=0; let max=0;
data.result.judge.subtasks.forEach(function (item) { data.result.judge.subtasks.forEach(function (item) {
item.cases.forEach(function (one) { item.cases.forEach(function (one) {

Loading…
Cancel
Save