Merge pull request !6626 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-11-21 12:54:58 +00:00
committed by Gitee
@@ -174,17 +174,14 @@ class HrAttendanceDetail(models.Model):
checkin_times = [rec.checkin_time + timedelta(hours=8) for rec in attendance_records if rec.checkin_time]
# 3. 确定有效上下班时间
check_in_end = self.float_to_datetime(current_data, template.check_in_end)
check_in_start = self.float_to_datetime(current_data, template.check_in_start)
if template.check_in_start > template.check_in_end:
valid_checkins = [
t for t in checkin_times
if check_in_end <= t <= check_in_start
]
check_in_start = self.float_to_datetime(current_data, template.check_in_start) - relativedelta(days=1)
else:
valid_checkins = [
t for t in checkin_times
if check_in_start <= t <= check_in_end
]
check_in_start = self.float_to_datetime(current_data, template.check_in_start)
valid_checkins = [
t for t in checkin_times
if check_in_start <= t <= check_in_end
]
# 上班时间:在上班范围内的最小打卡时间
check_in_time = min(valid_checkins) - timedelta(hours=8) if valid_checkins else None
check_out_start = self.float_to_datetime(current_data, template.check_out_start)