|
|
@@ -156,3 +156,31 @@ test('报表先定位课次时仍兼容报表对象、通用编号和原学习
|
|
|
}
|
|
|
assert.deepEqual((await db.query(targetSql, ['co', 'foreign-target'])).rows, []);
|
|
|
});
|
|
|
+
|
|
|
+test('已逐条核实的缺失预约快照补齐课型,同时核验学员和预约身份', () => {
|
|
|
+ const reportMetadata = {
|
|
|
+ verified: true, studentId: 1790, appointmentId: '802757', classType: '2',
|
|
|
+ durationMinutes: 60, courseId: 398, courseName: '阅读写作', categoryName: '语法写作课',
|
|
|
+ };
|
|
|
+ const row = { userId: 1790, dsid: '802757', reportMetadata, isWriting: true };
|
|
|
+ const writing = gateway.learningReportProjection(row);
|
|
|
+ assert.equal(writing.classTypeLabel, '语法写作课 60 分钟');
|
|
|
+ assert.equal(writing.courseName, '阅读写作');
|
|
|
+ assert.equal(writing.masteryRate, null);
|
|
|
+ assert.equal(gateway.learningReportProjection({ ...row, userId: 1828 }).classTypeLabel, '未设置');
|
|
|
+ assert.equal(gateway.learningReportProjection({ ...row, dsid: 'other' }).classTypeLabel, '未设置');
|
|
|
+ const trial = gateway.learningReportProjection({
|
|
|
+ userId: 1828, dsid: '817637',
|
|
|
+ reportMetadata: { ...reportMetadata, studentId: 1828, appointmentId: '817637', classType: '3', courseId: 405, categoryName: '体验课' },
|
|
|
+ });
|
|
|
+ assert.equal(trial.classTypeLabel, '体验课 60 分钟');
|
|
|
+});
|
|
|
+
|
|
|
+test('已核实的原预约写作课快照参与写作筛选,并拒绝身份不符的快照', async () => {
|
|
|
+ await db.exec('ALTER TABLE "DailyStudyRecord" ADD COLUMN "reportMetadata" jsonb');
|
|
|
+ const metadata = JSON.stringify({ verified: true, studentId: 1790, appointmentId: '802757', courseId: 398 });
|
|
|
+ await db.query('INSERT INTO "DailyStudyRecord" ("objectId",company,id,"userId",dsid,dqrq,xxqs,"reportMetadata") VALUES ($1,$2,19999,1790,$3,$4,$5,$6)', ['resolved-writing','co','802757','20260814','[]',metadata]);
|
|
|
+ await db.query('INSERT INTO "DailyStudyRecord" ("objectId",company,id,"userId",dsid,dqrq,xxqs,"reportMetadata") VALUES ($1,$2,20000,1800,$3,$4,$5,$6)', ['mismatched-writing','co','802757','20260814','[]',metadata]);
|
|
|
+ assert.deepEqual(await rows({ status: 'writing', studentId: 1790 }), ['resolved-writing']);
|
|
|
+ assert.deepEqual(await rows({ status: 'writing', studentId: 1800 }), []);
|
|
|
+});
|