演示数据生成逻辑微调
Build and publish Docker images / Test, build and publish (push) Successful in 11m47s

This commit is contained in:
2026-07-21 20:43:04 +08:00 Unverified
parent 207d75696b
commit 6f2cf2ded4
2 changed files with 20 additions and 5 deletions
+10 -5
View File
@@ -347,11 +347,11 @@ export function createSeedDatabase({ nowIso, hashPassword, candidateCount = 1200
id: `admission_plan_${school.key}`, kind: 'plan', examId, userId: `usr_${school.key}`, schoolId: school.id, status: 'approved',
payload: {
categories: [
{ code: 'general', name: '普通生', quota: mainCandidateCount, specialtyCategory: '', specialtyType: '', indicatorAllocations: [] },
{ code: 'sports', name: '体育特长生', quota: specialtyCandidateCount, specialtyCategory: 'sports', specialtyType: '', indicatorAllocations: [] },
{ code: 'arts', name: '艺术特长生', quota: specialtyCandidateCount, specialtyCategory: 'arts', specialtyType: '', indicatorAllocations: [] }
{ code: 'general', name: '普通生', quota: 350, specialtyCategory: '', specialtyType: '', indicatorAllocations: [] },
{ code: 'sports', name: '体育特长生', quota: 1, specialtyCategory: 'sports', specialtyType: '', indicatorAllocations: [] },
{ code: 'arts', name: '艺术特长生', quota: 1, specialtyCategory: 'arts', specialtyType: '', indicatorAllocations: [] }
],
note: '演示数据招生计划', submittedBy: `${school.name}招生办`, reviewedBy: '林老师', reviewedAt: admissionCreatedAt, publicVisible: true
note: '演示数据招生计划:普通类 350 人,特长生合计 2 人', submittedBy: `${school.name}招生办`, reviewedBy: '林老师', reviewedAt: admissionCreatedAt, publicVisible: true
},
createdAt: admissionCreatedAt, updatedAt: admissionCreatedAt
});
@@ -370,12 +370,17 @@ export function createSeedDatabase({ nowIso, hashPassword, candidateCount = 1200
});
}
const rotatedAdmissionSchools = admissionSchools.map((_, offset) => admissionSchools[(candidateIndex + offset) % admissionSchools.length]);
const choices = rotatedAdmissionSchools.map((school, choiceIndex) => ({
schoolId: school.id,
categoryCode: isSpecialtyCandidate && choiceIndex === 0 ? profile.specialtyCategory : 'general',
preferenceType: 'general'
}));
database.admissionRecords.push({
id: `preference_main_${String(candidateIndex + 1).padStart(4, '0')}`, kind: 'preference', examId,
userId: registration.userId, schoolId: null, status: 'submitted',
payload: {
round: 1, submissionCount: 1, submittedAt: new Date(Date.UTC(2026, 6, 5 + (candidateIndex % 10), 1 + (candidateIndex % 8), candidateIndex % 60)).toISOString(),
choices: rotatedAdmissionSchools.map(school => ({ schoolId: school.id, categoryCode: 'general', preferenceType: 'general' }))
choices
},
createdAt: admissionCreatedAt, updatedAt: '2026-07-15T08:00:00.000Z'
});