From 7348babbbdb85b3cc8e224db2f4096facc18363b Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Fri, 19 Jul 2019 16:46:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9F=BA=E6=9C=AC=E5=AE=8C=E6=88=90oj?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=BB=83=E4=B9=A0=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models-built/classify.js | 8 + models-built/classify.js.map | 2 +- models-built/classify_to_problem.js | 53 ++++ models-built/classify_to_problem.js.map | 1 + models-built/common.js | 31 ++ models-built/common.js.map | 2 +- models-built/user.js | 5 + models-built/user.js.map | 2 +- models-built/user_to_practice.js | 73 +++++ models-built/user_to_practice.js.map | 1 + models/classify.ts | 6 + models/classify_to_problem.ts | 18 ++ models/common.ts | 18 ++ models/user.ts | 4 + models/user_to_practice.ts | 34 ++ modules/practice.js | 340 +++++++++++++++++++- modules/problem.js | 65 +++- modules/submission.js | 66 ++++ views/admin_classify.ejs | 262 +++++++++++++--- views/admin_config.ejs | 1 - views/header.ejs | 5 +- views/practice.ejs | 238 ++------------ views/practice_classify.ejs | 26 ++ views/practice_problem.ejs | 392 ++++++++++++++++++++++++ views/submission.ejs | 27 +- 25 files changed, 1412 insertions(+), 268 deletions(-) create mode 100644 models-built/classify_to_problem.js create mode 100644 models-built/classify_to_problem.js.map create mode 100644 models-built/user_to_practice.js create mode 100644 models-built/user_to_practice.js.map create mode 100644 models/classify_to_problem.ts create mode 100644 models/user_to_practice.ts create mode 100644 views/practice_classify.ejs create mode 100644 views/practice_problem.ejs diff --git a/models-built/classify.js b/models-built/classify.js index 1e555d8..86a3573 100644 --- a/models-built/classify.js +++ b/models-built/classify.js @@ -43,6 +43,14 @@ var Classify = /** @class */ (function (_super) { TypeORM.Column({ nullable: true, type: "varchar", length: 100 }), __metadata("design:type", String) ], Classify.prototype, "intro"); + __decorate([ + TypeORM.Column({ type: "integer" }), + __metadata("design:type", Number) + ], Classify.prototype, "problem_num"); + __decorate([ + TypeORM.Column({ type: "integer" }), + __metadata("design:type", Number) + ], Classify.prototype, "order"); __decorate([ TypeORM.Column({ nullable: true, type: "integer" }), __metadata("design:type", Number) diff --git a/models-built/classify.js.map b/models-built/classify.js.map index 1aeae62..5dbe64d 100644 --- a/models-built/classify.js.map +++ b/models-built/classify.js.map @@ -1 +1 @@ -{"version":3,"file":"classify.js","sourceRoot":"","sources":["../models/classify.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AACnC,mCAA6B;AAM7B;IAAsC,4BAAK;IAA3C;;IAkBA,CAAC;IAjBU,cAAK,GAAG,IAAI,CAAC;IAGpB;QADC,OAAO,CAAC,sBAAsB,EAAE;;gCACtB;IAIX;QAFC,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAC/B,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;kCACjE;IAGb;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;mCACnD;IAGd;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;yCAChC;IAGpB;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;yCAChC;IAjBH,QAAQ;QAD5B,OAAO,CAAC,MAAM,EAAE;OACI,QAAQ,CAkB5B;IAAD,eAAC;CAAA,AAlBD,CAAsC,mBAAK,GAkB1C;qBAlBoB,QAAQ"} \ No newline at end of file +{"version":3,"file":"classify.js","sourceRoot":"","sources":["../models/classify.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AACnC,mCAA6B;AAM7B;IAAsC,4BAAK;IAA3C;;IAwBA,CAAC;IAvBU,cAAK,GAAG,IAAI,CAAC;IAGpB;QADC,OAAO,CAAC,sBAAsB,EAAE;;gCACtB;IAIX;QAFC,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAC/B,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;kCACjE;IAGb;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;mCACnD;IAGd;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;yCAChB;IAGpB;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;mCACtB;IAGd;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;yCAChC;IAGpB;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;yCAChC;IAvBH,QAAQ;QAD5B,OAAO,CAAC,MAAM,EAAE;OACI,QAAQ,CAwB5B;IAAD,eAAC;CAAA,AAxBD,CAAsC,mBAAK,GAwB1C;qBAxBoB,QAAQ"} \ No newline at end of file diff --git a/models-built/classify_to_problem.js b/models-built/classify_to_problem.js new file mode 100644 index 0000000..5bf1ffd --- /dev/null +++ b/models-built/classify_to_problem.js @@ -0,0 +1,53 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +exports.__esModule = true; +var TypeORM = require("typeorm"); +var common_1 = require("./common"); +var ClassifyToProblem = /** @class */ (function (_super) { + __extends(ClassifyToProblem, _super); + function ClassifyToProblem() { + return _super !== null && _super.apply(this, arguments) || this; + } + ClassifyToProblem.cache = true; + __decorate([ + TypeORM.PrimaryGeneratedColumn(), + __metadata("design:type", Number) + ], ClassifyToProblem.prototype, "id"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ nullable: true, type: "integer" }), + __metadata("design:type", Number) + ], ClassifyToProblem.prototype, "c_id"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ nullable: true, type: "integer" }), + __metadata("design:type", Number) + ], ClassifyToProblem.prototype, "p_id"); + ClassifyToProblem = __decorate([ + TypeORM.Entity() + ], ClassifyToProblem); + return ClassifyToProblem; +}(common_1["default"])); +exports["default"] = ClassifyToProblem; +//# sourceMappingURL=classify_to_problem.js.map \ No newline at end of file diff --git a/models-built/classify_to_problem.js.map b/models-built/classify_to_problem.js.map new file mode 100644 index 0000000..319aeb7 --- /dev/null +++ b/models-built/classify_to_problem.js.map @@ -0,0 +1 @@ +{"version":3,"file":"classify_to_problem.js","sourceRoot":"","sources":["../models/classify_to_problem.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AACnC,mCAA6B;AAG7B;IAA+C,qCAAK;IAApD;;IAaA,CAAC;IAZU,uBAAK,GAAG,IAAI,CAAC;IAGpB;QADC,OAAO,CAAC,sBAAsB,EAAE;;yCACtB;IAIX;QAFC,OAAO,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;2CACvC;IAIb;QAFC,OAAO,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;2CACvC;IAZI,iBAAiB;QADrC,OAAO,CAAC,MAAM,EAAE;OACI,iBAAiB,CAarC;IAAD,wBAAC;CAAA,AAbD,CAA+C,mBAAK,GAanD;qBAboB,iBAAiB"} \ No newline at end of file diff --git a/models-built/common.js b/models-built/common.js index 8ae8f68..ec82603 100644 --- a/models-built/common.js +++ b/models-built/common.js @@ -218,6 +218,26 @@ var Model = /** @class */ (function (_super) { }); }); }; + Model.querySomeColumn = function (queryBuilder) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, queryBuilder.select('id').addSelect('title').getRawMany()]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; + Model.updateColumnById = function (queryBuilder, updateObj, id) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, queryBuilder.set(updateObj).where("id = :id", { id: id }).execute()]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; Model.queryPage = function (paginater, where, order, largeData) { if (largeData === void 0) { largeData = false; } return __awaiter(this, void 0, void 0, function () { @@ -345,6 +365,17 @@ var Model = /** @class */ (function (_super) { }); }); }; + Model.queryBy = function (where) { + return __awaiter(this, void 0, void 0, function () { + var queryBuilder; + return __generator(this, function (_a) { + queryBuilder = where instanceof TypeORM.SelectQueryBuilder + ? where + : this.createQueryBuilder().where(where); + return [2 /*return*/, queryBuilder.getMany()]; + }); + }); + }; Model.cache = false; return Model; }(TypeORM.BaseEntity)); diff --git a/models-built/common.js.map b/models-built/common.js.map index 04aee1b..60236a9 100644 --- a/models-built/common.js.map +++ b/models-built/common.js.map @@ -1 +1 @@ -{"version":3,"file":"common.js","sourceRoot":"","sources":["../models/common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AACnC,oCAAsC;AACtC,mCAAqC;AAUrC,IAAK,cAGJ;AAHD,WAAK,cAAc;IACjB,oDAAS,CAAA;IACT,mDAAQ,CAAA;AACV,CAAC,EAHI,cAAc,KAAd,cAAc,QAGlB;AAED,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,uDAAO,CAAA;IACP,0DAAS,CAAA;AACX,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,IAAM,MAAM,GAAyC,IAAI,GAAG,EAAE,CAAC;AAE/D,SAAS,WAAW,CAAC,SAAS;IAC5B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QAC1B,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,QAAQ,CAAC;YACjC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU;SAChC,CAAC,CAAC,CAAC;KACL;IAED,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,QAAQ,CAAC,SAAS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C;IAnLM,WAAK,GAAG,KAAK,CAAC;IAqLvB,YAAC;CAAA,AAtLD,CAAmC,OAAO,CAAC,UAAU,GAsLpD;qBAtLoB,KAAK"} \ No newline at end of file diff --git a/models-built/user.js b/models-built/user.js index c8713fd..24ec427 100644 --- a/models-built/user.js +++ b/models-built/user.js @@ -385,6 +385,11 @@ var User = /** @class */ (function (_super) { TypeORM.Column({ nullable: true, type: "integer" }), __metadata("design:type", Number) ], User.prototype, "ac_num"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ nullable: true, type: "integer" }), + __metadata("design:type", Number) + ], User.prototype, "current_p_id"); __decorate([ TypeORM.Index(), TypeORM.Column({ nullable: true, type: "integer" }), diff --git a/models-built/user.js.map b/models-built/user.js.map index 6eea32f..a5403cd 100644 --- a/models-built/user.js.map +++ b/models-built/user.js.map @@ -1 +1 @@ -{"version":3,"file":"user.js","sourceRoot":"","sources":["../models/user.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AACnC,mCAA6B;AAI7B,6CAAuC;AACvC,mDAA6C;AAC7C,qCAAgC;AAGhC;IAAkC,wBAAK;IAAvC;;IAoMA,CAAC;aApMoB,IAAI;IAuDV,cAAS,GAAtB,UAAuB,KAAK;;;gBAC1B,sBAAO,MAAI,CAAC,OAAO,CAAC;wBAClB,KAAK,EAAE;4BACL,KAAK,EAAE,KAAK;yBACb;qBACF,CAAC,EAAC;;;KACJ;IAEY,aAAQ,GAArB,UAAsB,IAAI;;;gBACxB,sBAAO,MAAI,CAAC,OAAO,CAAC;wBAClB,KAAK,EAAE;4BACL,QAAQ,EAAE,IAAI;yBACf;qBACF,CAAC,EAAC;;;KACJ;IAEK,8BAAe,GAArB,UAAsB,IAAI;;;;;wBACxB,IAAI,CAAC,IAAI;4BAAE,sBAAO,KAAK,EAAC;wBACpB,qBAAM,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EA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O,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAO,EAAE,IAAI,EAAE,CAAC;;+CACpC;IAG/B;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;6BACxC;IAGZ;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;gCACrC;IAGf;QADC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;uCAC9B;IAzDH,IAAI;QADxB,OAAO,CAAC,MAAM,EAAE;OACI,IAAI,CAwMxB;IAAD,WAAC;CAAA,AAxMD,CAAkC,mBAAK,GAwMtC;qBAxMoB,IAAI"} \ No newline at end of file diff --git a/models-built/user_to_practice.js b/models-built/user_to_practice.js new file mode 100644 index 0000000..c9a949d --- /dev/null +++ b/models-built/user_to_practice.js @@ -0,0 +1,73 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +exports.__esModule = true; +var TypeORM = require("typeorm"); +var common_1 = require("./common"); +var UserToPractice = /** @class */ (function (_super) { + __extends(UserToPractice, _super); + function UserToPractice() { + return _super !== null && _super.apply(this, arguments) || this; + } + UserToPractice.cache = true; + __decorate([ + TypeORM.PrimaryGeneratedColumn(), + __metadata("design:type", Number) + ], UserToPractice.prototype, "id"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ nullable: true, type: "integer" }), + __metadata("design:type", Number) + ], UserToPractice.prototype, "u_id"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ nullable: true, type: "integer" }), + __metadata("design:type", Number) + ], UserToPractice.prototype, "c_id"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ nullable: true, type: "integer" }), + __metadata("design:type", Number) + ], UserToPractice.prototype, "p_id"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ type: "integer" }), + __metadata("design:type", Number) + ], UserToPractice.prototype, "is_practice"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ type: "integer" }), + __metadata("design:type", Number) + ], UserToPractice.prototype, "is_finished"); + __decorate([ + TypeORM.Index(), + TypeORM.Column({ type: "integer" }), + __metadata("design:type", Number) + ], UserToPractice.prototype, "practice_num"); + UserToPractice = __decorate([ + TypeORM.Entity() + ], UserToPractice); + return UserToPractice; +}(common_1["default"])); +exports["default"] = UserToPractice; +//# sourceMappingURL=user_to_practice.js.map \ No newline at end of file diff --git a/models-built/user_to_practice.js.map b/models-built/user_to_practice.js.map new file mode 100644 index 0000000..5344603 --- /dev/null +++ b/models-built/user_to_practice.js.map @@ -0,0 +1 @@ +{"version":3,"file":"user_to_practice.js","sourceRoot":"","sources":["../models/user_to_practice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AACnC,mCAA6B;AAG7B;IAA4C,kCAAK;IAAjD;;IA6BA,CAAC;IA5BU,oBAAK,GAAG,IAAI,CAAC;IAGpB;QADC,OAAO,CAAC,sBAAsB,EAAE;;sCACtB;IAIX;QAFC,OAAO,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;wCACvC;IAIb;QAFC,OAAO,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;wCACvC;IAIb;QAFC,OAAO,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;wCACvC;IAIb;QAFC,OAAO,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;+CAChB;IAIpB;QAFC,OAAO,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;+CAChB;IAIpB;QAFC,OAAO,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;gDACf;IA5BJ,cAAc;QADlC,OAAO,CAAC,MAAM,EAAE;OACI,cAAc,CA6BlC;IAAD,qBAAC;CAAA,AA7BD,CAA4C,mBAAK,GA6BhD;qBA7BoB,cAAc"} \ No newline at end of file diff --git a/models/classify.ts b/models/classify.ts index 2422db6..00517c6 100644 --- a/models/classify.ts +++ b/models/classify.ts @@ -18,6 +18,12 @@ export default class Classify extends Model { @TypeORM.Column({ nullable: true, type: "varchar", length: 100 }) intro: string; + @TypeORM.Column({ type: "integer" }) + problem_num: number; + + @TypeORM.Column({ type: "integer" }) + order: number; + @TypeORM.Column({ nullable: true, type: "integer" }) update_time: number; diff --git a/models/classify_to_problem.ts b/models/classify_to_problem.ts new file mode 100644 index 0000000..106bcd6 --- /dev/null +++ b/models/classify_to_problem.ts @@ -0,0 +1,18 @@ +import * as TypeORM from "typeorm"; +import Model from "./common"; + +@TypeORM.Entity() +export default class ClassifyToProblem extends Model { + static cache = true; + + @TypeORM.PrimaryGeneratedColumn() + id: number; + + @TypeORM.Index() + @TypeORM.Column({ nullable: true, type: "integer" }) + c_id: number; + + @TypeORM.Index() + @TypeORM.Column({ nullable: true, type: "integer" }) + p_id: number; +} diff --git a/models/common.ts b/models/common.ts index 5a1dc7a..112e23b 100644 --- a/models/common.ts +++ b/models/common.ts @@ -119,6 +119,15 @@ export default class Model extends TypeORM.BaseEntity { return await queryBuilder.getMany(); } + + static async querySomeColumn(queryBuilder) { + return await queryBuilder.select('id').addSelect('title').getRawMany(); + } + + static async updateColumnById(queryBuilder, updateObj: object, id:number) { + return await queryBuilder.set(updateObj).where("id = :id", { id }).execute(); + } + static async queryPage(paginater: Paginater, where, order, largeData = false) { if (!paginater.pageCnt) return []; @@ -208,4 +217,13 @@ export default class Model extends TypeORM.BaseEntity { return queryBuilder.getMany(); } + + static async queryBy(where) { + const queryBuilder = where instanceof TypeORM.SelectQueryBuilder + ? where + : this.createQueryBuilder().where(where); + + return queryBuilder.getMany(); + } + } diff --git a/models/user.ts b/models/user.ts index ab7ef87..7f340d0 100644 --- a/models/user.ts +++ b/models/user.ts @@ -37,6 +37,10 @@ export default class User extends Model { @TypeORM.Column({ nullable: true, type: "integer" }) ac_num: number; + @TypeORM.Index() + @TypeORM.Column({ nullable: true, type: "integer" }) + current_p_id: number; + @TypeORM.Index() @TypeORM.Column({ nullable: true, type: "integer" }) submit_num: number; diff --git a/models/user_to_practice.ts b/models/user_to_practice.ts new file mode 100644 index 0000000..b36ae0a --- /dev/null +++ b/models/user_to_practice.ts @@ -0,0 +1,34 @@ +import * as TypeORM from "typeorm"; +import Model from "./common"; + +@TypeORM.Entity() +export default class UserToPractice extends Model { + static cache = true; + + @TypeORM.PrimaryGeneratedColumn() + id: number; + + @TypeORM.Index() + @TypeORM.Column({ nullable: true, type: "integer" }) + u_id: number; + + @TypeORM.Index() + @TypeORM.Column({ nullable: true, type: "integer" }) + c_id: number; + + @TypeORM.Index() + @TypeORM.Column({ nullable: true, type: "integer" }) + p_id: number; + + @TypeORM.Index() + @TypeORM.Column({ type: "integer" }) + is_practice: number; + + @TypeORM.Index() + @TypeORM.Column({ type: "integer" }) + is_finished: number; + + @TypeORM.Index() + @TypeORM.Column({ type: "integer" }) + practice_num: number; +} diff --git a/modules/practice.js b/modules/practice.js index 33a6881..43a6250 100644 --- a/modules/practice.js +++ b/modules/practice.js @@ -1,9 +1,151 @@ let Classify = syzoj.model('classify'); +let Problem = syzoj.model('problem'); +let CToP = syzoj.model('classify_to_problem'); +let Article = syzoj.model('article'); +let User = syzoj.model('user'); +let UToP = syzoj.model('user_to_practice'); app.get('/practice', async (req, res) => { + if (!res.locals.user) { + res.render('error', { + err: new ErrorMessage('请先登录。') + }); + } else { + async function getUserInfo(userId) { + let userQuery = await User.createQueryBuilder(); + const currentUserInfo = await userQuery.where("id = :id", { id: userId }).getOne(); + return currentUserInfo.current_p_id; + } + try { + let classifyQuery = Classify.createQueryBuilder(); + let utopQuery = UToP.createQueryBuilder(); + let result = await Classify.queryAll(classifyQuery); + let userQuery = await User.createQueryBuilder(); + const userId = res.locals.user.id; + let currentPId = await getUserInfo(userId); + const test = []; + if (!currentPId) { + // 用户第一次进入练习板块 + await userQuery.update(User).set({current_p_id: 1}).where("id = :id", { id:userId }).execute(); + } else { + await result.forEachAsync(async resultItem => { + const c_id = resultItem.id; + let utopInfo = await utopQuery.where('c_id=:c_id',{c_id}).andWhere('u_id=:u_id',{u_id:userId}).andWhere("is_finished=1").getMany(); + resultItem.ac_num = utopInfo.length || 0; + if (resultItem.ac_num === resultItem.problem_num) { + if (resultItem.order < result.length ) { + currentPId = resultItem.order + 1 + await userQuery.update(User).set({current_p_id: currentPId}).where("id = :id", { id:userId }).execute(); + } + } else { + test.push(resultItem.order); + } + }); + } + if (test.length !== 0) { + const minOrder = Math.min.apply(null,test); + currentPId = minOrder; + await userQuery.update(User).set({current_p_id: minOrder}).where("id = :id", { id:userId }).execute(); + } + result.sort(function(a,b) { + return a.order - b.order; + }); + result.forEach(function(item) { + if (item.order <= currentPId) { + item.href = `/practice/classify/${item.id}`; + } + item.isNow = item.order === currentPId; + }); + let userACArray = await utopQuery.where('u_id=:u_id',{u_id:userId}).andWhere("is_finished=1").getMany(); + + const originRating = syzoj.config.default.user.rating; + const newRating = originRating + userACArray.length * syzoj.config.practice_rating; + await userQuery.update(User).set({rating: newRating}).where('id=:u_id',{u_id:userId}).execute(); + res.render('practice', { + user:res.locals.user, + result, + newRating + }) + } catch (e) { + syzoj.log(e); + res.render('error', { + err: e + }); + } + } +}); + +app.get('/practice/classify/:cid/problem/:pid', async (req, res) => { try { - res.render('practice', { + let id = parseInt(req.params.pid); + let cid = parseInt(req.params.cid); + let problem = await Problem.findById(id); + if (!problem) throw new ErrorMessage('无此题目。'); + + if (!await problem.isAllowedUseBy(res.locals.user)) { + throw new ErrorMessage('您没有权限进行此操作。'); + } + + problem.allowedEdit = await problem.isAllowedEditBy(res.locals.user); + problem.allowedManage = await problem.isAllowedManageBy(res.locals.user); + + if (problem.is_public || problem.allowedEdit) { + await syzoj.utils.markdown(problem, ['description', 'input_format', 'output_format', 'example', 'limit_and_hint']); + } else { + throw new ErrorMessage('您没有权限进行此操作。'); + } + + let state = await problem.getJudgeState(res.locals.user, false); + problem.tags = await problem.getTags(); + await problem.loadRelationships(); + + let testcases = await syzoj.utils.parseTestdata(problem.getTestdataPath(), problem.type === 'submit-answer'); + + let discussionCount = await Article.count({ problem_id: id }); + + res.render('practice_problem', { + problem: problem, + state: state, + lastLanguage: res.locals.user ? await res.locals.user.getLastSubmitLanguage() : null, + testcases: testcases, + discussionCount: discussionCount, + pid: id, + cid + }); + } catch (e) { + syzoj.log(e); + res.render('error', { + err: e + }); + } +}); + +app.get('/practice/classify/:id', async (req, res) => { + try { + const c_id = parseInt(req.params.id); + const u_id = res.locals.user.id; + let ctopQuery = CToP.createQueryBuilder(); + let query = await Problem.createQueryBuilder(); + let utopQuery = UToP.createQueryBuilder(); + let problemArray = await ctopQuery.where("c_id = :id", { id:c_id }).getMany(); + let utopResult = await utopQuery.where("c_id = :c_id", { c_id }).andWhere("u_id=:u_id", {u_id}).getMany(); + let problems = await problemArray.mapAsync(async problemArrayInfo => query.where('id=:id', {id: problemArrayInfo.p_id}).getOne()); + problems.forEach(function(problemItem) { + const obj = utopResult.find(function(item){return parseInt(item.p_id) === parseInt(problemItem.id)}); + problemItem.href = `/practice/classify/${c_id}/problem/${problemItem.id}`; + if (obj) { + problemItem.statusStr = obj.is_practice && obj.is_finished ? '已练习且已通过' : '已练习但未通过'; + } else { + problemItem.statusStr = '尚未练习' + } + }); + problems.sort(function(a, b){ + return a.id - b.id; + }) + res.render('practice_classify', { + user:res.locals.user, + problems }) } catch (e) { syzoj.log(e); @@ -13,19 +155,211 @@ app.get('/practice', async (req, res) => { } }); +app.get('/api/practice/classify/:id', async (req, res) => { + try { + let id = parseInt(req.params.id); + let query = await Classify.createQueryBuilder(); + let classifyInfo = await query.where('id=:id',{id}).getOne(); + let problem = await CToP.queryBy({c_id: id}); + res.send({ classifyInfo, problem:problem.map(function(item){return item.p_id}) }); + } catch(e) { + res.send({ error_code: e.errno, error_msg: '失败' }); + } +}); + +app.get('/api/pass/:cid/:pid',async (req, res) => { + try { + const c_id = parseInt(req.params.cid); + const p_id = parseInt(req.params.pid); + const u_id = res.locals.user.id; + let utopQuery = UToP.createQueryBuilder(); + let query = Classify.createQueryBuilder(); + let userQuery = User.createQueryBuilder(); + let classify = await Classify.queryAll(query); + classify.sort(function(a,b) { + return a.order - b.order; + }); + let utopResult = await utopQuery.where("c_id = :c_id", { c_id }).andWhere("u_id=:u_id", {u_id}).andWhere("p_id=:p_id", {p_id}).getOne(); + // 查询到结果了 + if (utopResult ) { + // mock答题通过了 + await utopQuery.update(UToP).set({is_finished: 1, practice_num: utopResult.practice_num + 1}).where("c_id = :c_id", { c_id }).andWhere("u_id=:u_id", {u_id}).andWhere("p_id=:p_id", {p_id}).execute(); + // 说明两个题都练习过了 + } else { + let utop = await UToP.create({ + u_id, + c_id, + p_id, + is_practice: 1, + is_finished: 1, + practice_num: 1 + }); + await utop.save(); + } + res.send(); + } catch(e) { + res.send({ error_code: e.errno, error_msg: '练习失败,请稍后重试' }); + } +}); + +app.get('/api/practice/nopass/:cid/:pid',async (req, res) => { + try { + const c_id = parseInt(req.params.cid); + const p_id = parseInt(req.params.pid); + const u_id = res.locals.user.id; + let utopQuery = UToP.createQueryBuilder(); + let query = Classify.createQueryBuilder(); + let utopResult = await utopQuery.where("c_id = :c_id", { c_id }).andWhere("u_id=:u_id", {u_id}).andWhere("p_id=:p_id", {p_id}).getOne(); + // 查询到结果了 + if (utopResult) { + // mock答题通过了 + await utopQuery.update(UToP).set({is_practice:1, is_finished: 0, practice_num: utopResult.practice_num + 1}).where("c_id = :c_id", { c_id }).andWhere("u_id=:u_id", {u_id}).andWhere("p_id=:p_id", {p_id}).execute(); + // 说明两个题都练习过了 + } else { + let utop = await UToP.create({ + u_id, + c_id, + p_id, + is_practice: 1, + practice_num: 1, + is_finished: 0 + }); + await utop.save(); + } + res.send(); + } catch(e) { + res.send({ error_code: e.errno, error_msg: '练习失败,请稍后重试' }); + } +}); + +app.put('/api/practice/classify/update/:id', async (req, res) => { + try { + let id = parseInt(req.params.id); + let u_id = parseInt(res.locals.user.id); + let utopQuery = UToP.createQueryBuilder(); + let classifyQuery = await Classify.createQueryBuilder(); + let ctopQuery = await CToP.createQueryBuilder(); + const {name, intro, problemIdArray, order} = req.body; + let classifyInfo = await classifyQuery.where('id=:id',{id}).getOne(); + // 新增题 + if (problemIdArray.length > classifyInfo.problem_num) { + /* + * 把当前练习的阶段设置为新增题的阶段,因为新增题后,当前阶段的题目就没答完。 + * */ + + } + // 删除题 + if (problemIdArray.length < classifyInfo.problem_num) { + // 1。找出两个数组的差异 + function findDifference(source, target){ + const parseIntTarget = target.map(function(item){ + return parseInt(item); + }) + return source.filter(function(item){ + return !parseIntTarget.includes(item); + }) + } + let ctopInfo = await ctopQuery.where('c_id=:id',{id}).getMany(); + const targetArray = ctopInfo.map(function(ctopInfoItem){ + return ctopInfoItem.p_id; + }) + // 2.从utop表里清除被删除题目的练习记录 + const differenceArray = findDifference(targetArray, problemIdArray); + differenceArray.forEachAsync(async differenceItem => { + await utopQuery.delete().from(UToP).where("c_id = :id", { id }).andWhere("u_id=:u_id",{u_id}).andWhere("p_id=:p_id",{p_id:differenceItem}).execute(); + }) + } + let updateClassifyInfo = await classifyQuery.update(Classify).set({name, intro, order, problem_num: problemIdArray.length}).where("id = :id", { id }).execute(); + await ctopQuery.delete().from(CToP).where("c_id = :id", { id }).execute(); + problemIdArray.forEach(async function (item) { + let ctop = await CToP.create({ + c_id: id, + p_id: item + }); + await ctop.save(); + }) + res.send({ updateClassifyInfo }); + } catch(e) { + res.send({ error_code: e.errno, error_msg: '失败' }); + } +}); + +app.get('/api/getProblem/:id', async (req, res) => { + let id = parseInt(req.params.id); + try { + let query = await Problem.createQueryBuilder(); + let problemInfo = await query.where('id=:id', {id}).getOne() + res.send({ problemInfo}); + } catch(e) { + res.send({ error_code: e.errno, error_msg: '失败' }); + } +}); + +app.get('/api/practice/all', async (req, res) => { + try { + let classifyQuery = Classify.createQueryBuilder(); + let ctopQuery = CToP.createQueryBuilder(); + let result = await Classify.queryAll(classifyQuery); + result.sort(function(a,b) { + return a.order - b.order; + }) + // if (result.length !== 0) { + // const currentClassifyId = result[0].id; + // + // } + let problem = await CToP.queryAll(ctopQuery); + res.send({ result, problem}); + } catch(e) { + res.send({ error_code: e.errno, error_msg: '失败' }); + } +}); + +app.get('/api/admin/practice/all', async (req, res) => { + try { + let classifyQuery = Classify.createQueryBuilder(); + let result = await Classify.queryAll(classifyQuery); + res.send({ result }); + } catch(e) { + res.send({ error_code: e.errno, error_msg: '失败' }); + } +}); + app.post('/api/practice/create', async (req, res) => { try { - const {name, intro} = req.body; + const {name, intro, problemIdArray, order} = req.body; let classify = await Classify.create({ name, intro, - updateTime: parseInt((new Date()).getTime() / 1000), + order, + problem_num: problemIdArray.length || 0, + updateTime: parseInt((new Date()).getTime() / 1000, 10), createTime: parseInt((new Date()).getTime() / 1000) }); await classify.save(); + let query = Classify.createQueryBuilder(); + let recordArray = await Classify.queryAll(query); + let lastRecordId = recordArray[recordArray.length - 1].id; + problemIdArray.forEach(async function (item) { + let ctop = await CToP.create({ + c_id: lastRecordId, + p_id: item + }) + await ctop.save(); + }) res.send(); } catch(e) { res.send({ error_code: e.errno, error_msg: '创建失败' }); } }); +app.get('/api/problem/all', async (req, res) => { + try { + let query = Problem.createQueryBuilder(); + let result = await Problem.querySomeColumn(query); + res.send({ result }); + } catch(e) { + res.send({ error_code: e.errno, error_msg: '失败' }); + } +}); + + diff --git a/modules/problem.js b/modules/problem.js index de2d564..5bea7c5 100644 --- a/modules/problem.js +++ b/modules/problem.js @@ -220,7 +220,6 @@ app.get('/problem/:id', async (req, res) => { let testcases = await syzoj.utils.parseTestdata(problem.getTestdataPath(), problem.type === 'submit-answer'); let discussionCount = await Article.count({ problem_id: id }); - res.render('problem', { problem: problem, state: state, @@ -599,6 +598,70 @@ app.post('/problem/:id/dis_public', async (req, res) => { await setPublic(req, res, false); }); +app.post('/problem/practice/:pid/:cid/submit', app.multer.fields([{ name: 'answer', maxCount: 1 }]), async (req, res) => { + try { + let pid = parseInt(req.params.pid); + let cid = parseInt(req.params.cid); + let problem = await Problem.findById(pid); + const curUser = res.locals.user; + + if (!problem) throw new ErrorMessage('无此题目。'); + if (problem.type !== 'submit-answer' && !syzoj.config.enabled_languages.includes(req.body.language)) throw new ErrorMessage('不支持该语言。'); + if (!curUser) throw new ErrorMessage('请登录后继续。', { '登录': syzoj.utils.makeUrl(['login'], { 'url': syzoj.utils.makeUrl(['problem', id]) }) }); + let judge_state; + let code; + if (req.files['answer']) { + if (req.files['answer'][0].size > syzoj.config.limit.submit_code) throw new ErrorMessage('代码文件太大。'); + code = (await fs.readFile(req.files['answer'][0].path)).toString(); + } else { + if (Buffer.from(req.body.code).length > syzoj.config.limit.submit_code) throw new ErrorMessage('代码太长。'); + code = req.body.code; + } + + judge_state = await JudgeState.create({ + submit_time: parseInt((new Date()).getTime() / 1000), + status: 'Unknown', + task_id: randomstring.generate(10), + code: code, + code_length: Buffer.from(code).length, + language: req.body.language, + user_id: curUser.id, + problem_id: pid, + is_public: problem.is_public + }); + + if (!await problem.isAllowedUseBy(curUser)) throw new ErrorMessage('您没有权限进行此操作。'); + judge_state.type = 0; + await judge_state.save(); + await judge_state.updateRelatedInfo(true); + + if (problem.type !== 'submit-answer' && syzoj.languages[req.body.language].format) { + let key = syzoj.utils.getFormattedCodeKey(judge_state.code, req.body.language); + let formattedCode = await FormattedCode.findOne({ + where: { + key: key + } + }); + } + + try { + await Judger.judge(judge_state, problem, 2); + judge_state.pending = true; + judge_state.status = 'Waiting'; + await judge_state.save(); + } catch (err) { + throw new ErrorMessage(`无法开始评测:${err.toString()}`); + } + + res.redirect(syzoj.utils.makeUrl(['submission', 'practice', judge_state.id, pid, cid])); + } catch (e) { + syzoj.log(e); + res.render('error', { + err: e + }); + } +}); + app.post('/problem/:id/submit', app.multer.fields([{ name: 'answer', maxCount: 1 }]), async (req, res) => { try { let id = parseInt(req.params.id); diff --git a/modules/submission.js b/modules/submission.js index 2404e8a..da08b67 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -152,6 +152,72 @@ app.get('/submissions', async (req, res) => { } }); +app.get('/submission/practice/:id/:pid/:cid', async (req, res) => { + try { + const id = parseInt(req.params.id); + const pid = parseInt(req.params.pid); + const cid = parseInt(req.params.cid); + const judge = await JudgeState.findById(id); + if (!judge) throw new ErrorMessage("提交记录 ID 不正确。"); + const curUser = res.locals.user; + if (!await judge.isAllowedVisitBy(curUser)) throw new ErrorMessage('您没有权限进行此操作。'); + + await judge.loadRelationships(); + + if (judge.problem.type !== 'submit-answer') { + let key = syzoj.utils.getFormattedCodeKey(judge.code, judge.language); + if (key) { + let formattedCode = await FormattedCode.findOne({ + where: { + key: key + } + }); + + if (formattedCode) { + judge.formattedCode = await syzoj.utils.highlight(formattedCode.code, syzoj.languages[judge.language].highlight); + } + } + judge.code = await syzoj.utils.highlight(judge.code, syzoj.languages[judge.language].highlight); + } + + let isAdmin = curUser === null ? false : curUser.is_admin; + let isAuthor = curUser === null ? false : curUser.id === judge.user_id; + + let currentConfig = Object.assign({}, displayConfig); + + currentConfig.showRejudge = isAuthor || await judge.problem.isAllowedEditBy(res.locals.user, judge.user_id); + if (isAdmin || isAuthor) { + currentConfig.showShare = true; + } + if (isAdmin || isAuthor || judge.is_share) { + judge.code = (judge.problem.type !== 'submit-answer') ? judge.code.toString("utf8") : ''; + } else { + judge.code = "作者没有开放此题代码,请联系作者分享。"; + } + res.render('submission', { + info: getSubmissionInfo(judge, currentConfig), + roughResult: getRoughResult(judge, currentConfig, false), + code: judge.code, + 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.pending && judge.task_id != null) ? jwt.sign({ + taskId: judge.task_id, + type: 'detail', + displayConfig: displayConfig + }, syzoj.config.session_secret) : null, + displayConfig: currentConfig, + cid, + pid + }); + } catch (e) { + syzoj.log(e); + res.render('error', { + err: e + }); + } +}); + app.get('/submission/:id', async (req, res) => { try { const id = parseInt(req.params.id); diff --git a/views/admin_classify.ejs b/views/admin_classify.ejs index 924c2e1..1eb2055 100644 --- a/views/admin_classify.ejs +++ b/views/admin_classify.ejs @@ -12,7 +12,7 @@
题目 | +状态 | +
---|---|
<%= problemItem.title %> | +<%= problemItem.statusStr %> | +