|
|
@@ -29,7 +29,7 @@ before(async()=>{
|
|
|
INSERT INTO "Node" VALUES ('co',100,8,'词表',99),('co',101,8,'空词表',99);
|
|
|
INSERT INTO "CommonModel" ("objectId","company","nodeId","modelId","status") SELECT 'word-'||i,'co',100,52,99 FROM generate_series(1,200) i;`);
|
|
|
await db.exec(enrollmentSql);
|
|
|
- await db.exec(`ALTER TABLE "LessonRecord" ADD pf text,ADD pjnr text,ADD pldp text,ADD plpjsj text;
|
|
|
+ await db.exec(`ALTER TABLE "LessonRecord" ADD pf numeric,ADD pjnr text,ADD pldp text,ADD plpjsj text;
|
|
|
ALTER TABLE "DailyStudyRecord" ADD company text,ADD id numeric,ADD "userId" numeric,ADD dsid text,ADD xxqs text,ADD fxrl text,ADD "updatedAt" timestamptz;
|
|
|
CREATE TABLE "MemoryPracticeRecord" ("objectId" text primary key,company text,id numeric,"sourceKey" text,"createdAt" timestamptz,"updatedAt" timestamptz,yhid numeric,plid numeric,"orderId" numeric,xxjlid numeric,kcid numeric,fxzt text,kywrq text,kywsj text);
|
|
|
CREATE TABLE "LessonCompletionReport" ("objectId" text primary key,company text,"createdAt" timestamptz,"updatedAt" timestamptz,"sourceKey" text,"appointmentId" text,"appointmentGeneralId" numeric,"lessonId" text,"studentId" numeric,"coachId" numeric,"courseCategoryKey" text,"courseCategoryName" text,"deliveryMode" text,"durationMinutes" numeric,"actualStartAt" timestamptz,"actualEndAt" timestamptz,"creditCosts" jsonb,"contentSummary" text,"vocabularyCount" numeric,"reviewStatus" text,"reviewSummary" text,"trainingStatus" text,"trainingSummary" text,"antiForgetSummary" jsonb,homework text,"noHomework" boolean,notes text,"submittedBy" text,"submittedAt" timestamptz);
|
|
|
@@ -90,7 +90,7 @@ test('旧11/20课次复用已扣凭据与评价,缺凭据不补扣',async()=>{
|
|
|
await db.query(`UPDATE "LessonRecord" SET pf='4',pjnr='原评价' WHERE yyds=$1`,[a.gid]);
|
|
|
await db.query(`UPDATE "CourseAppointment" SET dszt='20' WHERE "objectId"=$1`,[a.objectId]);
|
|
|
const v=(await one('SELECT "updatedAt" FROM "CourseAppointment" WHERE "objectId"=$1',[a.objectId])).updatedAt,before=await balance();
|
|
|
- assert.equal((await complete(a.gid,v,'legacy-request-001')).status,30);assert.equal(await balance(),before);assert.equal((await review(a.gid)).score,'4');
|
|
|
+ assert.equal((await complete(a.gid,v,'legacy-request-001')).status,30);assert.equal(await balance(),before);assert.equal(Number((await review(a.gid)).score),4);
|
|
|
const broken=await appointment();await db.query(`UPDATE "CourseAppointment" SET dszt='11' WHERE "objectId"=$1`,[broken.objectId]);
|
|
|
await assert.rejects(complete(broken.gid,broken.updatedAt,'legacy-request-002'),/历史凭据/);assert.equal(await balance(),before);
|
|
|
});
|
|
|
@@ -102,6 +102,15 @@ test('评价原子拒绝无效评分与超长文字',async()=>{
|
|
|
assert.equal(Number((await one('SELECT count(*) n FROM "LessonReview" WHERE "appointmentGeneralId"=$1',[a.gid])).n),1);
|
|
|
});
|
|
|
|
|
|
+test('线上数值型评分列允许首次评价并保留第一次评分',async()=>{
|
|
|
+ const schema=await one("SELECT data_type FROM information_schema.columns WHERE table_name='LessonRecord' AND column_name='pf'");
|
|
|
+ assert.equal(schema.data_type,'numeric');
|
|
|
+ const a=await appointment();await complete(a.gid,a.updatedAt,'numeric-review-request-001');
|
|
|
+ assert.equal((await review(a.gid,5,'首次评价')).score,5);
|
|
|
+ assert.equal((await review(a.gid,1,'重复评价')).score,5);
|
|
|
+ assert.equal(Number((await one('SELECT pf FROM "LessonRecord" WHERE yyds=$1',[a.gid])).pf),5);
|
|
|
+});
|
|
|
+
|
|
|
test('同日提前开课、午夜后继续、非预约当天与改派老师在数据库校验',async()=>{
|
|
|
const a=await appointment(false);
|
|
|
await db.query(`UPDATE "CourseAppointment" SET sdsd='23:59',yysj=bxrq||' 23:59' WHERE "objectId"=$1`,[a.objectId]);
|