修正
This commit is contained in:
+6
-2
@@ -357,6 +357,10 @@ export function buildSeedOperations(state) {
|
||||
}
|
||||
|
||||
function stateFromRows(rows) {
|
||||
const parseJson = (value, fallback) => {
|
||||
if (value != null && typeof value === 'object') return value;
|
||||
try { return JSON.parse(value || JSON.stringify(fallback)); } catch { return fallback; }
|
||||
};
|
||||
const subjectsByExam = new Map();
|
||||
for (const row of rows.subjects) {
|
||||
const fullScore = Number(row.full_score ?? 150);
|
||||
@@ -518,7 +522,7 @@ function stateFromRows(rows) {
|
||||
postalCode: row.postal_code || '',
|
||||
guardianName: row.guardian_name || '',
|
||||
guardianPhone: row.guardian_phone || '',
|
||||
specialtyTypes: (() => { try { return JSON.parse(row.specialty_types || '[]'); } catch { return []; } })(),
|
||||
specialtyTypes: parseJson(row.specialty_types, []),
|
||||
specialtyCertificate: row.specialty_certificate || '',
|
||||
policyEligibility: row.policy_eligibility || '',
|
||||
profileCompleted: Boolean(row.profile_completed),
|
||||
@@ -759,7 +763,7 @@ function stateFromRows(rows) {
|
||||
userId: row.user_id || null,
|
||||
schoolId: row.school_id || null,
|
||||
status: row.status,
|
||||
payload: (() => { try { return JSON.parse(row.payload_json || '{}'); } catch { return {}; } })(),
|
||||
payload: parseJson(row.payload_json, {}),
|
||||
createdAt: row.created_at,
|
||||
updatedAt: row.updated_at
|
||||
})),
|
||||
|
||||
Reference in New Issue
Block a user