|
|
@@ -10,9 +10,12 @@ async function fixture(run){
|
|
|
const db=new PGlite();try{
|
|
|
await db.exec(readFileSync(new URL('./fixtures/teacher-review-schema.sql',import.meta.url),'utf8'));
|
|
|
await db.exec(`ALTER TABLE "DailyStudyRecord" ADD COLUMN pl text,ADD COLUMN "canonicalStudyId" text;
|
|
|
+ ALTER TABLE "CourseAppointment" ADD COLUMN pl text,ADD COLUMN kssj text,ADD COLUMN jssj text;
|
|
|
+ ALTER TABLE "LessonRecord" ADD COLUMN jsmz text;
|
|
|
INSERT INTO "CommonModel"(company,"modelId","generalId","itemId",status,"sourceKey") VALUES('co',56,100,101,99,'legacy:model:56:general:100'),('co',54,200,201,99,'legacy:model:54:general:200');
|
|
|
INSERT INTO "DailyStudyRecord"(company,id,learned,xxqs,dsid,"userId",pl) VALUES('co',101,0,'','200',20,'30');
|
|
|
- INSERT INTO "CourseAppointment" VALUES('co',201,'20','30',NULL,'398','legacy:model:54:general:200');
|
|
|
+ INSERT INTO "CourseAppointment"(company,id,szyh,dszt,"courseCategoryKey",kcid,"sourceKey",pl)
|
|
|
+ VALUES('co',201,'20','30',NULL,'398','legacy:model:54:general:200','30');
|
|
|
INSERT INTO "Node" VALUES('co',398,'阅读写作');`);
|
|
|
const query=async(s,a)=>(await db.query(s,a)).rows;
|
|
|
const ctx=vm.createContext({Date,Promise,Parse:{},Psql:{query,one:async(s,a)=>(await query(s,a))[0],oneOrNone:async(s,a)=>(await query(s,a))[0]||null}});
|
|
|
@@ -52,7 +55,7 @@ test('普通空词表、错误学生、未完课、回收和无可信来源的39
|
|
|
test('旧预约状态滞后但已有同一学生同一课次的真实旧完课凭据时恢复笔记复习',()=>fixture(async({db,ctx,coach})=>{
|
|
|
await db.exec(`UPDATE "CourseAppointment" SET dszt='0',"courseCategoryKey"='high_writing';
|
|
|
INSERT INTO "CommonModel"(company,"modelId","generalId","itemId",status,"sourceKey") VALUES('co',59,300,301,99,'legacy:model:59:general:300');
|
|
|
- INSERT INTO "LessonRecord" VALUES('co',301,'200','20','398','legacy:model:59:general:300');`);
|
|
|
+ INSERT INTO "LessonRecord"(company,id,yyds,xymz,kcid,"sourceKey",jsmz) VALUES('co',301,'200','20','398','legacy:model:59:general:300','30');`);
|
|
|
const page=()=>ctx.appReviewPage({scope:'today',includeIncome:false},coach);
|
|
|
assert.equal((await page()).page.itemCount,2);
|
|
|
assert.equal((await ctx.recordDetailData({id:100},coach)).addon[0].reviewContentMode,'notes');
|
|
|
@@ -69,3 +72,20 @@ test('旧预约状态滞后但已有同一学生同一课次的真实旧完课
|
|
|
assert.equal((await ctx.recordDetailData({id:100},coach)).addon[0].reviewContentMode,undefined,patch);
|
|
|
}
|
|
|
}));
|
|
|
+
|
|
|
+test('旧系统已结束、待课后确认的阅读写作任务可显示并打开笔记',()=>fixture(async({db,ctx,coach})=>{
|
|
|
+ await db.exec(`UPDATE "CourseAppointment" SET dszt='11',kssj='2026-10-13 10:43',jssj='2026-10-13 11:40';
|
|
|
+ INSERT INTO "CommonModel"(company,"modelId","generalId","itemId",status,"sourceKey") VALUES('co',59,300,301,99,'legacy:model:59:general:300');
|
|
|
+ INSERT INTO "LessonRecord"(company,id,yyds,xymz,kcid,"sourceKey",jsmz) VALUES('co',301,'200','20','398','legacy:model:59:general:300','30');`);
|
|
|
+ const page=()=>ctx.appReviewPage({scope:'today',includeIncome:false},coach);
|
|
|
+ const detail=()=>ctx.recordDetailData({id:100},coach);
|
|
|
+ for(const status of ['11','20']){
|
|
|
+ await db.query('UPDATE "CourseAppointment" SET dszt=$1',[status]);
|
|
|
+ assert.equal((await page()).page.itemCount,2);
|
|
|
+ assert.equal((await detail()).addon[0].reviewContentMode,'notes');
|
|
|
+ }
|
|
|
+ await db.exec(`UPDATE "LessonRecord" SET jsmz='31'`);
|
|
|
+ assert.equal((await page()).page.itemCount,0);
|
|
|
+ await db.exec(`UPDATE "LessonRecord" SET jsmz='30';UPDATE "CourseAppointment" SET jssj=''`);
|
|
|
+ assert.equal((await page()).page.itemCount,0);
|
|
|
+}));
|