|
@@ -25,13 +25,17 @@ function reviewStudentNameSql() {
|
|
|
return `COALESCE(NULLIF(BTRIM(u."realName"),''),NULLIF(BTRIM(u."nickname"),''),NULLIF(BTRIM(u."legacyUserData"->>'HoneyName'),''),CASE WHEN POSITION('@' IN c."title")>0 THEN NULLIF(BTRIM(SPLIT_PART(c."title",'@',1)),'') END,NULLIF(BTRIM(u."username"),''),'学员 '||m."yhid"::text)`;
|
|
return `COALESCE(NULLIF(BTRIM(u."realName"),''),NULLIF(BTRIM(u."nickname"),''),NULLIF(BTRIM(u."legacyUserData"->>'HoneyName'),''),CASE WHEN POSITION('@' IN c."title")>0 THEN NULLIF(BTRIM(SPLIT_PART(c."title",'@',1)),'') END,NULLIF(BTRIM(u."username"),''),'学员 '||m."yhid"::text)`;
|
|
|
}
|
|
}
|
|
|
function notesReviewSourceSql() {
|
|
function notesReviewSourceSql() {
|
|
|
- // Completed imports of legacy 阅读写作 (398) need no inferred billing stage to review notes.
|
|
|
|
|
|
|
+ // Some classified legacy bookings retain dszt=0; an exact legacy lesson proves completion without changing billing state.
|
|
|
return `EXISTS (SELECT 1 FROM "CommonModel" ac JOIN "CourseAppointment" a ON a.company=ac.company AND a.id=ac."itemId"
|
|
return `EXISTS (SELECT 1 FROM "CommonModel" ac JOIN "CourseAppointment" a ON a.company=ac.company AND a.id=ac."itemId"
|
|
|
WHERE ac.company=d.company AND ac."modelId"=54 AND ac."generalId"::text=d.dsid::text AND COALESCE(ac.status,99)<>-2
|
|
WHERE ac.company=d.company AND ac."modelId"=54 AND ac."generalId"::text=d.dsid::text AND COALESCE(ac.status,99)<>-2
|
|
|
- AND a.szyh::text=d."userId"::text AND a.dszt IN ('11','20','30','40')
|
|
|
|
|
- AND (a."courseCategoryKey" IN ('primary_writing','middle_writing','high_writing')
|
|
|
|
|
- OR (NULLIF(BTRIM(a."courseCategoryKey"),'') IS NULL AND a.kcid::text='398' AND a.dszt IN ('30','40')
|
|
|
|
|
- AND a."sourceKey"='legacy:model:54:general:'||ac."generalId"::text AND ac."sourceKey"=a."sourceKey")))`;
|
|
|
|
|
|
|
+ AND a.szyh::text=d."userId"::text
|
|
|
|
|
+ AND ((a."courseCategoryKey" IN ('primary_writing','middle_writing','high_writing') AND a.dszt IN ('11','20','30','40'))
|
|
|
|
|
+ OR ((NULLIF(BTRIM(a."courseCategoryKey"),'') IS NULL OR a."courseCategoryKey" IN ('primary_writing','middle_writing','high_writing'))
|
|
|
|
|
+ AND a.kcid::text='398' AND a."sourceKey"='legacy:model:54:general:'||ac."generalId"::text AND ac."sourceKey"=a."sourceKey"
|
|
|
|
|
+ AND (a.dszt IN ('30','40') OR (a.dszt='0' AND EXISTS (
|
|
|
|
|
+ SELECT 1 FROM "LessonRecord" l JOIN "CommonModel" lc ON lc.company=l.company AND lc."modelId"=59 AND lc."itemId"=l.id AND lc.status=99
|
|
|
|
|
+ WHERE l.company=a.company AND l.yyds::text=ac."generalId"::text AND l.xymz::text=d."userId"::text AND l.kcid::text='398'
|
|
|
|
|
+ AND l."sourceKey"='legacy:model:59:general:'||lc."generalId"::text AND lc."sourceKey"=l."sourceKey"))))))`;
|
|
|
}
|
|
}
|
|
|
async function appReviewPage(input,current) {
|
|
async function appReviewPage(input,current) {
|
|
|
const uid=await authorizeRequestedUser(current,input.uid),coach=number(current.get('legacyGroupId'))===3,p=mobilePage(input),includeMetadata=input.includeMetadata!==false,today=appOverviewToday();
|
|
const uid=await authorizeRequestedUser(current,input.uid),coach=number(current.get('legacyGroupId'))===3,p=mobilePage(input),includeMetadata=input.includeMetadata!==false,today=appOverviewToday();
|