|
|
@@ -5,7 +5,7 @@ const prepare=async(id,actor='teacher')=>(await one('SELECT xs_prepare_legacy_ap
|
|
|
before(async()=>{
|
|
|
await db.exec(`CREATE TABLE "_User"("objectId" text primary key,company text,"legacyUserId" numeric,"legacyUserData" jsonb,"isDisabled" boolean,"isDeleted" boolean,"adminRoleKey" text);
|
|
|
CREATE TABLE "CommonModel"("objectId" text primary key,company text,"modelId" numeric,"itemId" numeric,"generalId" numeric,status numeric,"sourceKey" text);
|
|
|
- CREATE TABLE "CourseAppointment"("objectId" text primary key,company text,id numeric,szyh text,pl text,kcid text,yykcid text,dszt text,dslx text,jffs text,bxrq text,yysj text,"sourceKey" text,"teachingManaged" boolean,"bindingId" text,"courseCategoryKey" text,"courseCategoryName" text,"durationMinutes" numeric,"deliveryMode" text,"teachingRuleId" text,"teacherPaySnapshot" numeric,"creditCostsSnapshot" jsonb,"creditHoldStatus" text,"creditHoldReason" text,"updatedAt" timestamptz);
|
|
|
+ CREATE TABLE "CourseAppointment"("objectId" text primary key,company text,id numeric,szyh text,pl text,kcid text,yykcid text,dszt text,dslx text,jffs text,bxrq text,yysj text,"sourceKey" text,"teachingManaged" boolean,"bindingId" text,"courseCategoryKey" text,"courseCategoryName" text,"categoryEvidence" text,"durationMinutes" numeric,"deliveryMode" text,"teachingRuleId" text,"teacherPaySnapshot" numeric,"creditCostsSnapshot" jsonb,"creditHoldStatus" text,"creditHoldReason" text,"updatedAt" timestamptz);
|
|
|
CREATE TABLE "CourseBinding"("objectId" text primary key,company text,id numeric,yhid text,kcid text,"categoryKey" text,"categoryName" text,"enrollmentStatus" text,"sourceKey" text,"updatedAt" timestamptz);
|
|
|
CREATE TABLE "CourseTeachingProfile"(company text,"courseId" numeric,"categoryKey" text,confirmed boolean);
|
|
|
CREATE TABLE "TeachingCourseCategory"(company text,key text,active boolean);
|
|
|
@@ -50,3 +50,13 @@ test('新导入的空分类开课只补明确的非写作分类;全局写作
|
|
|
await db.exec(`UPDATE "CourseBinding" SET "enrollmentStatus"=null,"categoryKey"=null,"categoryName"=null`);const id=await fixture();await prepare(id);assert.equal((await one('SELECT "categoryKey" FROM "CourseBinding" WHERE "objectId"=\'binding\'')).categoryKey,'word');
|
|
|
await db.exec(`UPDATE "CourseBinding" SET "enrollmentStatus"=null,"categoryKey"=null,"categoryName"=null;UPDATE "CourseTeachingProfile" SET "categoryKey"='high_writing'`);await assert.rejects(prepare(await fixture()),/按学员/);await db.exec(`UPDATE "CourseTeachingProfile" SET "categoryKey"='word'`);
|
|
|
});
|
|
|
+
|
|
|
+test('旧阅读写作预约经逐人确认高中后免词库核验,保留原课程并预留课时',async()=>{
|
|
|
+ const id=await fixture({kcid:'398',yykcid:'398',courseCategoryKey:'high_writing',categoryEvidence:'用户确认高中'});
|
|
|
+ const r=await prepare(id);assert.equal(r.changed,true);
|
|
|
+ const a=await one('SELECT * FROM "CourseAppointment" WHERE "objectId"=$1',[id.slice(0,-1)]);
|
|
|
+ assert.equal(a.kcid,'398');assert.equal(a.bindingId,null);assert.equal(a.creditHoldStatus,'ready');assert.equal(Number(a.teacherPaySnapshot),65);
|
|
|
+ assert.equal((await one('SELECT count(*)::int n FROM "CourseCreditReservation" WHERE "appointmentId"=$1',[id])).n,1);
|
|
|
+ assert.equal((await prepare(id)).changed,false);
|
|
|
+});
|
|
|
+test('旧阅读写作未确认学段不得自动预留',async()=>{const id=await fixture({kcid:'398',yykcid:'398'});await assert.rejects(prepare(id),/单词|分类|课程/);});
|