legacy-appointment-transform.mjs 1.1 KB

12345678910111213
  1. // Reuse the operations defaults instead of maintaining a second mobile price list.
  2. export function legacyAppointmentDefaults(operationsCode) {
  3. const start=operationsCode.indexOf('const TEACHING_STAGE_DEFAULTS='),end=operationsCode.indexOf('async function teachingCategoryRows(',start);
  4. if(start<0||end<start)throw Error('缺少旧预约核对所需的默认课时规则');
  5. return '\nfunction legacyAppointmentSeedRules(){function text(value){return String(value==null?\'\':value).trim();}\n'+operationsCode.slice(start,end)+'\nreturn defaultTeachingRules();}\n';
  6. }
  7. // The admin review and automatic preparation use the same grade and conflict rules.
  8. export function legacyWritingStageSupport(integrityCode) {
  9. const start=integrityCode.indexOf('function writingSchoolYear('),end=integrityCode.indexOf('async function writingMappingPage(',start);
  10. if(start<0||end<start)throw Error('缺少旧写作预约的学段核对规则');
  11. return '\nconst legacyWritingStageAssessment=(()=>{\nfunction text(value){return String(value??"").trim();}\n'+integrityCode.slice(start,end)+'\nreturn writingStageAssessment;\n})();\n';
  12. }