考勤记录显示记录人,默认出勤写入原因;撤销"节前上课"特殊类型

1. 考勤记录查询关联 users 表返回记录人姓名(修复记录人为空)
2. 默认出勤生成的记录原因写为"默认出勤";整天请假未填原因时默认"请假(整天)"
3. "假前下午上课"属于偶发情况,默认不做:移除 pre_holiday 校历类型,需要时按正常考勤流程单独补录下午记录
4. 已确认:默认出勤记录可被异常考勤覆盖(覆盖时按异常状态正常扣分)
This commit is contained in:
canglan committed 2026-11-26 09:53:51 +08:00
1 parent 97f2de5d83
commit 0ac933a3a5
6 files changed
+14 -18

No files matched your search

+5 -7
View File
@@ -34,7 +34,7 @@ ATTENDANCE_STATUS_MAP = {
# 手动校历设置的存储前缀与类型
CALENDAR_KEY_PREFIX = 'calendar_day:'
CALENDAR_TYPES = ('holiday', 'makeup', 'pre_holiday')
CALENDAR_TYPES = ('holiday', 'makeup')
VALID_SLOTS = ('morning', 'afternoon', 'evening')
MAX_DEFAULT_DAYS = 180
@@ -232,7 +232,7 @@ class AttendanceService:
iso = day.isoformat()
manual = calendar_info['manual'].get(iso)
if manual:
return manual['type'] != 'holiday'
return manual['type'] == 'makeup'
if iso in calendar_info['holidays']:
return False
if iso in calendar_info['workdays']:
@@ -248,7 +248,7 @@ class AttendanceService:
"""按学校常规作息返回某天实际考勤时段
- 上课日且次日仍上课:所选时段(早/中/晚)
- 放假前一天(次日不上课):仅上午;手动设为 pre_holiday 时按早+中
- 放假前一天(次日不上课):仅上午
- 返校日(非上课日、次日上课):仅晚修
- 其他休息日:无
"""
@@ -260,9 +260,6 @@ class AttendanceService:
if school_today:
if school_next:
return list(selected)
manual_type = calendar_info['manual'].get(day.isoformat(), {}).get('type')
if manual_type == 'pre_holiday':
return [s for s in selected if s in ('morning', 'afternoon')]
return [s for s in selected if s == 'morning']
if school_next:
return [s for s in selected if s == 'evening']
@@ -292,6 +289,7 @@ class AttendanceService:
if not slots:
return {"success": False, "message": "该日期没有考勤时段(休息日)"}
effective_reason = (reason or '').strip() or '请假(整天)'
created_count = 0
last_error = None
for student_id in student_ids:
@@ -300,7 +298,7 @@ class AttendanceService:
student_id=student_id,
date=date_str,
status='leave',
reason=reason,
reason=effective_reason,
apply_deduction=True,
recorder_id=recorder_id,
custom_deduction=None,