默认出勤支持"假前下午上课"例外(校历新增"节前上课"类型)

1. 校历手动设置新增类型 pre_holiday(节前上课,早+中,无晚修)
2. 默认出勤:放假前一天默认只生成上午;若该日手动设为"节前上课",则生成早+中
3. 校历弹窗/列表与文档同步更新
This commit is contained in:
canglan committed 2026-11-26 09:46:19 +08:00
1 parent d9dd7bf7e8
commit ad50f82c7b
5 files changed
+16 -5

No files matched your search

+10 -2
View File
@@ -34,7 +34,7 @@ ATTENDANCE_STATUS_MAP = {
# 手动校历设置的存储前缀与类型
CALENDAR_KEY_PREFIX = 'calendar_day:'
CALENDAR_TYPES = ('holiday', 'makeup')
CALENDAR_TYPES = ('holiday', 'makeup', 'pre_holiday')
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'] == 'makeup'
return manual['type'] != 'holiday'
if iso in calendar_info['holidays']:
return False
if iso in calendar_info['workdays']:
@@ -290,9 +290,17 @@ class AttendanceService:
school_next = AttendanceService._is_school_day(next_day, calendar_info)
if school_today:
manual_type = calendar_info['manual'].get(cursor_day.isoformat(), {}).get('type')
if school_next:
slots_today = list(selected_slots)
full_days += 1
elif manual_type == 'pre_holiday':
# 例外:假前需下午上课(早+中,无晚修),不按半天处理
slots_today = [s for s in selected_slots if s in ('morning', 'afternoon')]
if slots_today:
half_days += 1
else:
rest_days += 1
else:
slots_today = [s for s in selected_slots if s == 'morning']
if slots_today: