fix(attendance): normalize DingTalk match statuses

Store and validate stable English status codes for unmatched, pending, and matched attendance records so import, filtering, and auto-match use the same values.
This commit is contained in:
2026-07-10 14:11:55 +08:00
parent 1ca4a4d185
commit e26a8e816e
4 changed files with 6 additions and 6 deletions

View File

@@ -344,14 +344,14 @@ export class AttendanceService {
}
record.matchedStudentId = dto.studentId;
record.matchStatus = '已匹配';
record.matchStatus = 'matched';
return this.dingRawRepo.save(record);
}
// ── Auto-match unmatched dingtalk records via dingUserId → userId mapping chain ──
async autoMatchDingRecords(): Promise<{ matched: number; total: number }> {
const unmatched = await this.dingRawRepo.find({
where: { matchStatus: '未处理' },
where: { matchStatus: 'unmatched' },
});
if (unmatched.length === 0) return { matched: 0, total: 0 };
@@ -369,7 +369,7 @@ export class AttendanceService {
if (studentId == null) continue;
record.matchedStudentId = studentId;
record.matchStatus = '已匹配';
record.matchStatus = 'matched';
await this.dingRawRepo.save(record);
matched++;
}