From 97db034af6449b3d1a3bd209b72d3052a37dfd1d Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Wed, 7 Aug 2019 09:52:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?bugfix:=E5=86=8D=E6=AC=A1=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=9F=90=E4=BA=9B=E6=B5=8B=E8=AF=84=E5=8D=95=E9=A1=B9=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=B8=BA0=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/socketio.js | 42 +++++++++++++++++++----------------- views/admin_classify.ejs | 5 +---- views/submission.ejs | 20 ++++++++--------- views/submission_contest.ejs | 20 ++++++++--------- 4 files changed, 43 insertions(+), 44 deletions(-) diff --git a/modules/socketio.js b/modules/socketio.js index 420441e..07057ed 100644 --- a/modules/socketio.js +++ b/modules/socketio.js @@ -27,26 +27,27 @@ function processOverallResult(source, config) { } return { compile: source.compile, - judge: config.showDetailResult ? (source.judge && { - subtasks: source.judge.subtasks && source.judge.subtasks.map(st => ({ - score: st.score, - cases: st.cases.map(cs => ({ - status: cs.status, - result: cs.result && { - type: cs.result.type, - time: config.showUsage ? cs.result.time : undefined, - memory: config.showUsage ? cs.result.memory : undefined, - scoringRate: cs.result.scoringRate, - systemMessage: cs.result.systemMessage, - input: config.showTestdata ? cs.result.input : undefined, - output: config.showTestdata ? cs.result.output : undefined, - userOutput: config.showTestdata ? cs.result.userOutput : undefined, - userError: config.showTestdata ? cs.result.userError : undefined, - spjMessage: config.showTestdata ? cs.result.spjMessage : undefined, - } - })) + judge: { + subtasks: source.judge && source.judge.subtasks ? source.judge.subtasks.map(st => ({ + score: st.score, + cases: st.cases.map(cs => ({ + status: cs.status, + errorMessage: cs.errorMessage, + result: cs.result && { + type: cs.result.type, + time: config.showUsage ? cs.result.time : undefined, + memory: config.showUsage ? cs.result.memory : undefined, + scoringRate: cs.result.scoringRate, + systemMessage: cs.result.systemMessage, + input: config.showTestdata ? cs.result.input : undefined, + output: config.showTestdata ? cs.result.output : undefined, + userOutput: config.showTestdata ? cs.result.userOutput : undefined, + userError: config.showTestdata ? cs.result.userError : undefined, + spjMessage: config.showTestdata ? cs.result.spjMessage : undefined, + } })) - }) : null + })) : null + } }; } function getCompileStatus(status) { @@ -149,7 +150,8 @@ function initializeSocketIO(s) { return { ok: true, finished: false, - running: false + running: false, + result: processOverallResult(finishedJudgeList[taskId], clientDisplayConfigList[socket.id]) }; } } diff --git a/views/admin_classify.ejs b/views/admin_classify.ejs index 1e40705..b52fa53 100644 --- a/views/admin_classify.ejs +++ b/views/admin_classify.ejs @@ -160,7 +160,6 @@ return !this.disabledId.includes(row.id); }, toggleSelection(rows) { - console.log(rows); if (rows) { rows.forEach(row => { this.$refs.multipleTable.toggleRowSelection(row); @@ -237,7 +236,7 @@ } that.disabledId = findDifference(currentIdArray, that.usedProblemId); that.multipleSelection = that.problemIdArray; - that.toggleSelection(that.multipleSelection) + that.getProblemPagination(1); that.order = order; } }, @@ -249,7 +248,6 @@ }, show: function(id){ let that = this; - this.getProblemPagination(1); if (id) { this.classifyId = id; this.getClassifyInfos(id); @@ -274,7 +272,6 @@ order: this.order, problemIdArray: this.multipleSelection.map(item=>item.id) } - console.log(obj.problemIdArray); if (this.classifyId === -1) { $.ajax({ url: '/api/practice/create', diff --git a/views/submission.ejs b/views/submission.ejs index f02dad2..cbe29b4 100644 --- a/views/submission.ejs +++ b/views/submission.ejs @@ -351,17 +351,17 @@ if (token != null) { }); socket.emit('join', token, function (data) { console.log("join! ", data); - let max=0; - if (data && data.result && data.result.judge) { - data.result.judge.subtasks.forEach(function (item) { - item.cases.forEach(function (one) { - max = one.result.time - }); - }); - } if (data && data.ok) { - if (data.finished) { - data.roughResult.maxItemTime = max; + if (data.finished && data.result && data.result.judge) { + let max=0; + data.result.judge.subtasks.forEach(function (item) { + item.cases.forEach(function (one) { + max = one.result.time + }); + }); + if (max !== 0) { + data.roughResult.maxItemTime = max; + } vueApp.roughData.result = data.roughResult; // if (!data.result) location.reload(true); vueApp.detailResult = data.result; diff --git a/views/submission_contest.ejs b/views/submission_contest.ejs index f865583..e4484d9 100644 --- a/views/submission_contest.ejs +++ b/views/submission_contest.ejs @@ -352,17 +352,17 @@ if (token != null) { }); socket.emit('join', token, function (data) { console.log("join! ", data); - let max=0; - if (data && data.result && data.result.judge) { - data.result.judge.subtasks.forEach(function (item) { - item.cases.forEach(function (one) { - max = one.result.time - }); - }); - } if (data && data.ok) { - if (data.finished) { - data.roughResult.maxItemTime = max; + if (data.finished && data.result && data.result.judge) { + let max=0; + data.result.judge.subtasks.forEach(function (item) { + item.cases.forEach(function (one) { + max = one.result.time + }); + }); + if (max !== 0) { + data.roughResult.maxItemTime = max; + } vueApp.roughData.result = data.roughResult; // if (!data.result) location.reload(true); vueApp.detailResult = data.result; From 3a5491550d637715b4d199c37d9d1c7be46e0953 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Wed, 7 Aug 2019 10:21:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?bugfix:=E5=8F=AA=E5=9C=A8=E6=B5=8B=E8=AF=84?= =?UTF-8?q?=E6=97=B6=E8=A7=A6=E5=8F=91socket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/submission.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/submission.js b/modules/submission.js index 2034d8b..f916f5c 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -293,7 +293,7 @@ app.get('/submission/:id', async (req, res) => { formattedCode: judge.formattedCode ? judge.formattedCode.toString("utf8") : null, preferFormattedCode: res.locals.user ? res.locals.user.prefer_formatted_code : true, detailResult: processOverallResult(judge.result, currentConfig), - socketToken: (judge.task_id != null) ? jwt.sign({ + socketToken: (judge.pending && judge.task_id != null) ? jwt.sign({ taskId: judge.task_id, type: 'detail', displayConfig: displayConfig