|
@@ -24,9 +24,10 @@ before(async () => {
|
|
|
"nickname" text,"nickName" text,"realName" text,"createdAt" timestamptz);
|
|
"nickname" text,"nickName" text,"realName" text,"createdAt" timestamptz);
|
|
|
CREATE TABLE "CourseAppointment"("company" text,"id" int,"szyh" text,"pl" text,"dszt" text,"bxrq" text,"yysj" text,"isDeleted" boolean);
|
|
CREATE TABLE "CourseAppointment"("company" text,"id" int,"szyh" text,"pl" text,"dszt" text,"bxrq" text,"yysj" text,"isDeleted" boolean);
|
|
|
CREATE TABLE "CommonModel"("company" text,"modelId" int,"itemId" int,"status" int,"updatedAt" timestamptz,"isDeleted" boolean);
|
|
CREATE TABLE "CommonModel"("company" text,"modelId" int,"itemId" int,"status" int,"updatedAt" timestamptz,"isDeleted" boolean);
|
|
|
|
|
+ CREATE TABLE "DailyStudyRecord"("company" text,"id" int,"userId" numeric,"pl" text,"isDeleted" boolean);
|
|
|
`);
|
|
`);
|
|
|
});
|
|
});
|
|
|
-beforeEach(() => db.exec('TRUNCATE "_User","CourseAppointment","CommonModel"'));
|
|
|
|
|
|
|
+beforeEach(() => db.exec('TRUNCATE "_User","CourseAppointment","CommonModel","DailyStudyRecord"'));
|
|
|
after(() => db.close());
|
|
after(() => db.close());
|
|
|
|
|
|
|
|
async function user(id, { disabled = false, deleted = false, group = 1, company = 'co' } = {}) {
|
|
async function user(id, { disabled = false, deleted = false, group = 1, company = 'co' } = {}) {
|
|
@@ -38,7 +39,7 @@ async function appointment(id, student, { date = '2026-10-31', yysj = '', status
|
|
|
await db.query('INSERT INTO "CommonModel" VALUES($1,54,$2,$3,$4,$5)', [company, id, commonStatus, '2026-10-30T00:00:00Z', commonDeleted]);
|
|
await db.query('INSERT INTO "CommonModel" VALUES($1,54,$2,$3,$4,$5)', [company, id, commonStatus, '2026-10-30T00:00:00Z', commonDeleted]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-test('仅列出正常学员账号且在当前老师名下仍有今天或未来排课,先筛选再分页', async () => {
|
|
|
|
|
|
|
+test('没有授课记录时仅列出正常账号且仍有今天或未来排课的学员,先筛选再分页', async () => {
|
|
|
for (let id = 1; id <= 13; id++) await user(id, { disabled: id === 2, deleted: id === 3, group: id === 4 ? 3 : 1 });
|
|
for (let id = 1; id <= 13; id++) await user(id, { disabled: id === 2, deleted: id === 3, group: id === 4 ? 3 : 1 });
|
|
|
await appointment(1, 1);
|
|
await appointment(1, 1);
|
|
|
await appointment(2, 2);
|
|
await appointment(2, 2);
|
|
@@ -72,6 +73,24 @@ test('日期兼容紧凑日期、斜线日期及预约时间回退,空日期
|
|
|
assert.deepEqual(ids(await page()).sort((a, b) => a - b), [1, 2, 3]);
|
|
assert.deepEqual(ids(await page()).sort((a, b) => a - b), [1, 2, 3]);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+test('有授课记录的正常学员在最后一节课结束后仍可查看历史,过滤停用、删除、取消及其他老师记录', async () => {
|
|
|
|
|
+ for (let id = 1; id <= 9; id++) {
|
|
|
|
|
+ await user(id, { disabled: id === 2, deleted: id === 3, group: id === 4 ? 3 : 1 });
|
|
|
|
|
+ await appointment(id, id, { date: '2026-10-29', status: '30' });
|
|
|
|
|
+ await db.query('INSERT INTO "DailyStudyRecord" VALUES($1,$2,$3,$4,$5)',
|
|
|
|
|
+ [id === 5 ? 'other' : 'co', id, String(id), id === 6 ? '301' : '300', id === 7]);
|
|
|
|
|
+ await db.query('INSERT INTO "CommonModel" VALUES($1,56,$2,$3,$4,$5)',
|
|
|
|
|
+ [id === 5 ? 'other' : 'co', id, id === 8 ? -2 : 99, '2026-10-29T00:00:00Z', id === 9]);
|
|
|
|
|
+ }
|
|
|
|
|
+ await user(10); await appointment(10, 10); // Future lesson remains eligible before first study.
|
|
|
|
|
+ await user(11); await appointment(11, 11, { date: '2026-10-29', status: '30' }); // No study record.
|
|
|
|
|
+ const first = await page({ selectedStudentId: 1, psize: 1 });
|
|
|
|
|
+ const second = await page({ selectedStudentId: 1, psize: 1, cpage: 2 });
|
|
|
|
|
+ assert.equal(first.page.itemCount, 2);
|
|
|
|
|
+ assert.deepEqual(ids(first), [1]);
|
|
|
|
|
+ assert.deepEqual(ids(second), [10]);
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
test('恢复有效学员时将其放在首屏,停用或无排课的旧选择不能绕过筛选', async () => {
|
|
test('恢复有效学员时将其放在首屏,停用或无排课的旧选择不能绕过筛选', async () => {
|
|
|
for (let id = 1; id <= 4; id++) { await user(id, { disabled: id === 4 }); await appointment(id, id); }
|
|
for (let id = 1; id <= 4; id++) { await user(id, { disabled: id === 4 }); await appointment(id, id); }
|
|
|
await user(5);
|
|
await user(5);
|