fix(attendance): 출퇴근 자동생성 시 입사일 체크
initializeDailyRecords()에서 hire_date <= date 조건 추가. 입사일 이전 출퇴근 기록 자동생성 방지. 기존 잘못된 데이터 1건(조승민 1/2) 삭제. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -150,9 +150,10 @@ class AttendanceModel {
|
|||||||
static async initializeDailyRecords(date, createdBy) {
|
static async initializeDailyRecords(date, createdBy) {
|
||||||
const db = await getDb();
|
const db = await getDb();
|
||||||
|
|
||||||
// 1. 활성 작업자 조회
|
// 1. 활성 작업자 조회 (입사일 이전 제외)
|
||||||
const [workers] = await db.execute(
|
const [workers] = await db.execute(
|
||||||
'SELECT user_id FROM workers WHERE status = "active" AND user_id IS NOT NULL'
|
'SELECT user_id FROM workers WHERE status = "active" AND user_id IS NOT NULL AND (hire_date IS NULL OR hire_date <= ?)',
|
||||||
|
[date]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (workers.length === 0) return { inserted: 0 };
|
if (workers.length === 0) return { inserted: 0 };
|
||||||
|
|||||||
Reference in New Issue
Block a user