准考证优化
This commit is contained in:
+19
-13
@@ -57,7 +57,7 @@ function buildSeedOperations(state) {
|
||||
const nullable = value => value == null || value === '' ? null : value;
|
||||
|
||||
add(
|
||||
'UPDATE schema_metadata SET schema_version = 9, app_version = ?, self_registration_enabled = ?, created_at = ? WHERE id = 1',
|
||||
'UPDATE schema_metadata SET schema_version = 10, app_version = ?, self_registration_enabled = ?, created_at = ? WHERE id = 1',
|
||||
Number(state.meta?.version || 1), state.settings?.selfRegistrationEnabled ? 1 : 0,
|
||||
state.meta?.createdAt || new Date().toISOString()
|
||||
);
|
||||
@@ -219,16 +219,17 @@ function buildSeedOperations(state) {
|
||||
const card = registration.admitCard;
|
||||
add(
|
||||
`INSERT INTO admit_cards (
|
||||
registration_id, plan_id, card_number, center_id, test_center, generated_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?)`,
|
||||
registration.id, card.planId, card.number, nullable(card.centerId), card.testCenter, card.generatedAt
|
||||
registration_id, plan_id, card_number, center_id, test_center, center_code, center_address, generated_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
registration.id, card.planId, card.number, nullable(card.centerId), card.testCenter,
|
||||
card.centerCode || '', card.centerAddress || '', card.generatedAt
|
||||
);
|
||||
for (const assignment of card.assignments || []) add(
|
||||
`INSERT INTO admit_card_subjects (
|
||||
registration_id, subject_id, room_id, room, room_code, exam_room_code, seat, subject_signature
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
registration_id, subject_id, room_id, room, room_code, exam_room_code, building, floor, seat, subject_signature
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
registration.id, assignment.subjectId, nullable(assignment.roomId), assignment.roomName || assignment.room,
|
||||
assignment.roomCode, assignment.examRoomCode, assignment.seat, assignment.subjectSignature || ''
|
||||
assignment.roomCode, assignment.examRoomCode, assignment.building || '', assignment.floor || '', assignment.seat, assignment.subjectSignature || ''
|
||||
);
|
||||
}
|
||||
|
||||
@@ -374,6 +375,8 @@ function stateFromRows(rows) {
|
||||
room: row.room,
|
||||
roomCode: row.room_code,
|
||||
examRoomCode: row.exam_room_code,
|
||||
building: row.building || '',
|
||||
floor: row.floor || '',
|
||||
seat: row.seat,
|
||||
subjectSignature: row.subject_signature || ''
|
||||
});
|
||||
@@ -390,6 +393,8 @@ function stateFromRows(rows) {
|
||||
number: row.card_number,
|
||||
centerId: row.center_id,
|
||||
testCenter: row.test_center,
|
||||
centerCode: row.center_code || '',
|
||||
centerAddress: row.center_address || '',
|
||||
room: primary.roomName || '',
|
||||
seat: primary.seat || '',
|
||||
assignments,
|
||||
@@ -1265,16 +1270,17 @@ function createRepository({ client, location, read, transaction, close }) {
|
||||
for (const card of cards) {
|
||||
operations.push(operation(
|
||||
`INSERT INTO admit_cards (
|
||||
registration_id, plan_id, card_number, center_id, test_center, generated_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?)`,
|
||||
card.registrationId, plan.id, card.number, optional(card.centerId), card.testCenter, card.generatedAt
|
||||
registration_id, plan_id, card_number, center_id, test_center, center_code, center_address, generated_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
card.registrationId, plan.id, card.number, optional(card.centerId), card.testCenter,
|
||||
card.centerCode || '', card.centerAddress || '', card.generatedAt
|
||||
));
|
||||
for (const assignment of card.assignments) operations.push(operation(
|
||||
`INSERT INTO admit_card_subjects (
|
||||
registration_id, subject_id, room_id, room, room_code, exam_room_code, seat, subject_signature
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
registration_id, subject_id, room_id, room, room_code, exam_room_code, building, floor, seat, subject_signature
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
card.registrationId, assignment.subjectId, optional(assignment.roomId), assignment.roomName,
|
||||
assignment.roomCode, assignment.examRoomCode, assignment.seat, assignment.subjectSignature
|
||||
assignment.roomCode, assignment.examRoomCode, assignment.building || '', assignment.floor || '', assignment.seat, assignment.subjectSignature
|
||||
));
|
||||
}
|
||||
operations.push(auditOperation(log));
|
||||
|
||||
Reference in New Issue
Block a user