From a8cabe16cd7f97ad02e1ce9d8505f80c3098b481 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Tue, 23 Jul 2019 10:06:28 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=E4=BF=AE=E5=A4=8D=E5=9C=A8=E6=B5=8B?= =?UTF-8?q?=E8=AF=84=E5=88=97=E8=A1=A8=E7=82=B9=E5=87=BB=E6=97=B6=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=8E=B7=E5=8F=96=E5=88=B0=E5=8F=82=E6=95=B0=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E9=A1=B5=E9=9D=A2=E5=B4=A9=E6=BA=83=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/submissions_process.js | 2 + models-built/judge_state.js | 10 + models-built/judge_state.js.map | 2 +- models/judge_state.ts | 7 + modules/practice.js | 3 +- modules/problem.js | 4 +- modules/submission.js | 2 +- views/submission.ejs | 58 ----- views/submission_practice.ejs | 439 ++++++++++++++++++++++++++++++++ views/submissions_item.ejs | 7 + 10 files changed, 472 insertions(+), 62 deletions(-) create mode 100644 views/submission_practice.ejs diff --git a/libs/submissions_process.js b/libs/submissions_process.js index b9eb89c..e3d56c3 100644 --- a/libs/submissions_process.js +++ b/libs/submissions_process.js @@ -11,6 +11,8 @@ const getSubmissionInfo = (s, displayConfig) => ({ language: displayConfig.showCode ? ((s.language != null && s.language !== '') ? syzoj.languages[s.language].show : null) : null, codeSize: displayConfig.showCode ? s.code_length : null, submitTime: syzoj.utils.formatDate(s.submit_time), + isPractice: s.is_practice, + c_id: s.c_id }); const getRoughResult = (x, displayConfig, roughOnly) => { diff --git a/models-built/judge_state.js b/models-built/judge_state.js index 1afe4a4..b105d2a 100644 --- a/models-built/judge_state.js +++ b/models-built/judge_state.js @@ -354,6 +354,16 @@ var JudgeState = /** @class */ (function (_super) { TypeORM.Column({ nullable: true, type: "integer" }), __metadata("design:type", Number) ], JudgeState.prototype, "submit_time"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ nullable: true, type: "integer" }), + __metadata("design:type", Number) + ], JudgeState.prototype, "c_id"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ nullable: true, type: "integer" }), + __metadata("design:type", Number) + ], JudgeState.prototype, "is_practice"); __decorate([ TypeORM.Column({ nullable: true, type: "integer" }), __metadata("design:type", Number) diff --git a/models-built/judge_state.js.map b/models-built/judge_state.js.map index 19146cf..dd8064e 100644 --- a/models-built/judge_state.js.map +++ b/models-built/judge_state.js.map @@ -1 +1 @@ -{"version":3,"file":"judge_state.js","sourceRoot":"","sources":["../models/judge_state.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AACnC,mCAA6B;AAI7B,+BAA0B;AAC1B,qCAAgC;AAChC,qCAAgC;AAEhC,IAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEnC,IAAK,MAgBJ;AAhBD,WAAK,MAAM;IACT,+BAAqB,CAAA;IACrB,yCAA+B,CAAA;IAC/B,mCAAyB,CAAA;IACzB,qDAA2C,CAAA;IAC3C,+CAAqC,CAAA;IACrC,yDAA+C,CAAA;IAC/C,qCAA2B,CAAA;IAC3B,yDAA+C,CAAA;IAC/C,iDAAuC,CAAA;IACvC,yCAA+B,CAAA;IAC/B,uCAA6B,CAAA;IAC7B,qDAA2C,CAAA;IAC3C,6BAAmB,CAAA;IACnB,uCAA6B,CAAA;IAC7B,6BAAmB,CAAA;AACrB,CAAC,EAhBI,MAAM,KAAN,MAAM,QAgBV;AASD;IAAwC,8BAAK;IAA7C;;IAwKA,CAAC;IA7FO,sCAAiB,GAAvB;;;;;;6BACM,CAAC,IAAI,CAAC,IAAI,EAAV,wBAAU;wBACZ,KAAA,IAAI,CAAA;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AM,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC5D,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;QAClD,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;QAC9D,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;OACrC,UAAU,CA+K9B;IAAD,iBAAC;CAAA,AA/KD,CAAwC,mBAAK,GA+K5C;qBA/KoB,UAAU"} \ No newline at end of file diff --git a/models/judge_state.ts b/models/judge_state.ts index 81f7fc7..8328128 100644 --- a/models/judge_state.ts +++ b/models/judge_state.ts @@ -87,6 +87,13 @@ export default class JudgeState extends Model { @TypeORM.Column({ nullable: true, type: "integer" }) submit_time: number; + @TypeORM.Index() + @TypeORM.Column({ nullable: true, type: "integer" }) + c_id: number; + + @TypeORM.Index() + @TypeORM.Column({ nullable: true, type: "integer" }) + is_practice: number; /* * "type" indicate it's contest's submission(type = 1) or normal submission(type = 0) * if it's contest's submission (type = 1), the type_info is contest_id diff --git a/modules/practice.js b/modules/practice.js index 64590ab..3e0e36e 100644 --- a/modules/practice.js +++ b/modules/practice.js @@ -27,6 +27,7 @@ app.get('/practice', async (req, res) => { if (!currentPId) { // 用户第一次进入练习板块 await userQuery.update(User).set({current_p_id: 1}).where("id = :id", { id:userId }).execute(); + currentPId = 1; } else { await result.forEachAsync(async resultItem => { const c_id = resultItem.id; @@ -202,7 +203,7 @@ app.get('/api/pass/:cid/:pid',async (req, res) => { } }); -app.get('/api/practice/nopass/:cid/:pid',async (req, res) => { +app.get('/api/nopass/:cid/:pid',async (req, res) => { try { const c_id = parseInt(req.params.cid); const p_id = parseInt(req.params.pid); diff --git a/modules/problem.js b/modules/problem.js index 5bea7c5..50903cb 100644 --- a/modules/problem.js +++ b/modules/problem.js @@ -627,7 +627,9 @@ app.post('/problem/practice/:pid/:cid/submit', app.multer.fields([{ name: 'answe language: req.body.language, user_id: curUser.id, problem_id: pid, - is_public: problem.is_public + is_public: problem.is_public, + c_id:cid, + is_practice:1 }); if (!await problem.isAllowedUseBy(curUser)) throw new ErrorMessage('您没有权限进行此操作。'); diff --git a/modules/submission.js b/modules/submission.js index da08b67..e24acf9 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -194,7 +194,7 @@ app.get('/submission/practice/:id/:pid/:cid', async (req, res) => { } else { judge.code = "作者没有开放此题代码,请联系作者分享。"; } - res.render('submission', { + res.render('submission_practice', { info: getSubmissionInfo(judge, currentConfig), roughResult: getRoughResult(judge, currentConfig, false), code: judge.code, diff --git a/views/submission.ejs b/views/submission.ejs index acd314b..71b9c5e 100644 --- a/views/submission.ejs +++ b/views/submission.ejs @@ -28,9 +28,6 @@ .accordion > .content > .accordion > .content > :last-child { margin-bottom: -10px !important; } -.disabled{ - display: none; -}
@@ -55,8 +52,6 @@ -
<%= cid %>
-
<%= pid %>
<% if (formattedCode !== null) { %> @@ -317,8 +312,6 @@ const vueApp = new Vue({ }); if (token != null) { const loadSocketIO = function () { - const cid = parseInt(document.getElementById('cid').innerHTML); - const pid = parseInt(document.getElementById('pid').innerHTML); let currentVersion = 0; const socket = io(socketUrl); socket.on('connect', function () { @@ -343,68 +336,17 @@ if (token != null) { console.log("Judge finished"); vueApp.roughData.running = false; vueApp.roughData.result = p.roughResult; - if (p.roughResult.result === 'Accepted') { - $.ajax({ - url: `/api/pass/${cid}/${pid}`, - type: 'GET', - success: function (data) { - }, - error: function (XMLHttpRequest, textStatus, errorThrown) { - alert('练习功能发生故障'); - } - }); - } else { - $.ajax({ - url: `/api/nopass/${cid}/${pid}`, - type: 'GET', - success: function (data) { - }, - error: function (XMLHttpRequest, textStatus, errorThrown) { - alert('练习功能发生故障'); - } - }); - } vueApp.detailResult = p.result; socket.close(); }); socket.emit('join', token, function (data) { console.log("join! ", data); - // data.ok=true; - // data.finished=true; - // data.roughResult = { - // memory: 7128, - // result: "Accepted", - // score: 100, - // time: 272, - // } - // data.running=false; if (data && data.ok) { if (data.finished) { vueApp.roughData.result = data.roughResult; // if (!data.result) location.reload(true); vueApp.detailResult = data.result; vueApp.roughData.running = false; - // if (data.roughResult.result === 'Accepted') { - // $.ajax({ - // url: `/api/pass/${cid}/${pid}`, - // type: 'GET', - // success: function (data) { - // }, - // error: function (XMLHttpRequest, textStatus, errorThrown) { - // alert('练习功能发生故障'); - // } - // }); - // } else { - // $.ajax({ - // url: `/api/nopass/${cid}/${pid}`, - // type: 'GET', - // success: function (data) { - // }, - // error: function (XMLHttpRequest, textStatus, errorThrown) { - // alert('练习功能发生故障'); - // } - // }); - // } socket.close(); } else { if (data.running) { diff --git a/views/submission_practice.ejs b/views/submission_practice.ejs new file mode 100644 index 0000000..365e410 --- /dev/null +++ b/views/submission_practice.ejs @@ -0,0 +1,439 @@ +<% this.title = '提交记录 #' + info.submissionId %> +<% include util %> +<% include header %> + + + + + + + + +<% include submissions_item %> + + + + + + +<% include footer %> diff --git a/views/submissions_item.ejs b/views/submissions_item.ejs index fdd2381..4ed15a0 100644 --- a/views/submissions_item.ejs +++ b/views/submissions_item.ejs @@ -34,9 +34,16 @@ } else return 'Waiting'; }, submissionLink() { + if (this.data.info.c_id && this.data.info.isPractice) { + const practiceUrl = `practice/${this.data.info.submissionId}/${this.data.info.problemId}/${this.data.info.c_id}` + return submissionUrl.replace('20000528', practiceUrl); + } return submissionUrl.replace('20000528', this.data.info.submissionId); }, problemLink() { + if (this.data.info.c_id && this.data.info.isPractice) { + return `practice/classify/${this.data.info.c_id}/problem/${this.data.info.problemId}` + } return problemUrl.replace('20000528', this.data.info.problemId); }, userLink() {