默认出勤支持"假前下午上课"例外(校历新增"节前上课"类型)
1. 校历手动设置新增类型 pre_holiday(节前上课,早+中,无晚修) 2. 默认出勤:放假前一天默认只生成上午;若该日手动设为"节前上课",则生成早+中 3. 校历弹窗/列表与文档同步更新
This commit is contained in:
1 parent
d9dd7bf7e8
commit
ad50f82c7b
5 files changed
+16
-5
No files matched your search
@@ -84,7 +84,7 @@ class DefaultAttendanceRequest(BaseModel):
|
|||||||
class CalendarDayRequest(BaseModel):
|
class CalendarDayRequest(BaseModel):
|
||||||
"""校历手动设置请求"""
|
"""校历手动设置请求"""
|
||||||
date: date
|
date: date
|
||||||
day_type: str = Field(..., pattern=r'^(holiday|makeup)$', description="类型: holiday=放假, makeup=补课")
|
day_type: str = Field(..., pattern=r'^(holiday|makeup|pre_holiday)$', description="类型: holiday=放假, makeup=补课, pre_holiday=节前上课(早+中)")
|
||||||
note: Optional[str] = Field(None, max_length=100, description="备注")
|
note: Optional[str] = Field(None, max_length=100, description="备注")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ ATTENDANCE_STATUS_MAP = {
|
|||||||
|
|
||||||
# 手动校历设置的存储前缀与类型
|
# 手动校历设置的存储前缀与类型
|
||||||
CALENDAR_KEY_PREFIX = 'calendar_day:'
|
CALENDAR_KEY_PREFIX = 'calendar_day:'
|
||||||
CALENDAR_TYPES = ('holiday', 'makeup')
|
CALENDAR_TYPES = ('holiday', 'makeup', 'pre_holiday')
|
||||||
VALID_SLOTS = ('morning', 'afternoon', 'evening')
|
VALID_SLOTS = ('morning', 'afternoon', 'evening')
|
||||||
MAX_DEFAULT_DAYS = 180
|
MAX_DEFAULT_DAYS = 180
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ class AttendanceService:
|
|||||||
iso = day.isoformat()
|
iso = day.isoformat()
|
||||||
manual = calendar_info['manual'].get(iso)
|
manual = calendar_info['manual'].get(iso)
|
||||||
if manual:
|
if manual:
|
||||||
return manual['type'] == 'makeup'
|
return manual['type'] != 'holiday'
|
||||||
if iso in calendar_info['holidays']:
|
if iso in calendar_info['holidays']:
|
||||||
return False
|
return False
|
||||||
if iso in calendar_info['workdays']:
|
if iso in calendar_info['workdays']:
|
||||||
@@ -290,9 +290,17 @@ class AttendanceService:
|
|||||||
school_next = AttendanceService._is_school_day(next_day, calendar_info)
|
school_next = AttendanceService._is_school_day(next_day, calendar_info)
|
||||||
|
|
||||||
if school_today:
|
if school_today:
|
||||||
|
manual_type = calendar_info['manual'].get(cursor_day.isoformat(), {}).get('type')
|
||||||
if school_next:
|
if school_next:
|
||||||
slots_today = list(selected_slots)
|
slots_today = list(selected_slots)
|
||||||
full_days += 1
|
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:
|
else:
|
||||||
slots_today = [s for s in selected_slots if s == 'morning']
|
slots_today = [s for s in selected_slots if s == 'morning']
|
||||||
if slots_today:
|
if slots_today:
|
||||||
|
|||||||
+2
-1
@@ -186,6 +186,7 @@
|
|||||||
- **返校日**(非上课日、次日上课,如周日)→ 仅生成**晚修**出勤
|
- **返校日**(非上课日、次日上课,如周日)→ 仅生成**晚修**出勤
|
||||||
- **上课日且次日仍上课** → 按所选时段生成(早/中/晚)
|
- **上课日且次日仍上课** → 按所选时段生成(早/中/晚)
|
||||||
- **放假前一天**(上课日、次日不上课)→ 仅生成**上午**出勤(中午离校,无下午/晚修)
|
- **放假前一天**(上课日、次日不上课)→ 仅生成**上午**出勤(中午离校,无下午/晚修)
|
||||||
|
- **例外**:个别假前需要下午上课的,可在「节假日/补课」里把该日手动设为 **"节前上课(早+中)"**,则该日按早+中生成(无晚修)
|
||||||
- **跳过周末与法定节假日**(节假日/调休补班来自国内在线接口,失败时自动切换备用接口)
|
- **跳过周末与法定节假日**(节假日/调休补班来自国内在线接口,失败时自动切换备用接口)
|
||||||
- **调休补班日照常**(接口中的补班日按上课处理);**手动补课日照常**、手动放假日跳过
|
- **调休补班日照常**(接口中的补班日按上课处理);**手动补课日照常**、手动放假日跳过
|
||||||
- 已有的考勤记录(含缺勤/迟到/请假)**不会被覆盖**
|
- 已有的考勤记录(含缺勤/迟到/请假)**不会被覆盖**
|
||||||
@@ -195,7 +196,7 @@
|
|||||||
点击工具栏"节假日/补课"按钮打开校历设置:
|
点击工具栏"节假日/补课"按钮打开校历设置:
|
||||||
|
|
||||||
- **查询范围**:查看范围内的法定节假日(放假)、调休补班(按上课)——来自国内在线接口(失败时自动切换备用接口),只读
|
- **查询范围**:查看范围内的法定节假日(放假)、调休补班(按上课)——来自国内在线接口(失败时自动切换备用接口),只读
|
||||||
- **手动添加**:添加学校自己的安排,可选择"补课(按上课)"或"放假(按休息)",可填写备注;手动设置**优先于接口**(例如把某天调休补班改回放假)
|
- **手动添加**:添加学校自己的安排,可选择「补课(按上课)」「节前上课(早+中)」或「放假(按休息)」,可填写备注;手动设置**优先于接口**(例如把某天调休补班改回放假,或把假前半天改为下午上课)
|
||||||
- 手动添加的记录可随时删除
|
- 手动添加的记录可随时删除
|
||||||
|
|
||||||
**默认扣分规则**:
|
**默认扣分规则**:
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ include __DIR__ . '/../includes/header.php';
|
|||||||
<input type="date" id="calendarNewDate" style="width:auto;">
|
<input type="date" id="calendarNewDate" style="width:auto;">
|
||||||
<select id="calendarNewType" style="width:auto;">
|
<select id="calendarNewType" style="width:auto;">
|
||||||
<option value="makeup">补课(按上课)</option>
|
<option value="makeup">补课(按上课)</option>
|
||||||
|
<option value="pre_holiday">节前上课(早+中)</option>
|
||||||
<option value="holiday">放假(按休息)</option>
|
<option value="holiday">放假(按休息)</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="text" id="calendarNewNote" placeholder="备注(选填)" maxlength="100" style="flex:1; min-width:120px;">
|
<input type="text" id="calendarNewNote" placeholder="备注(选填)" maxlength="100" style="flex:1; min-width:120px;">
|
||||||
|
|||||||
@@ -308,10 +308,11 @@ function renderCalendar(data) {
|
|||||||
items.push({ date: d, type: 'makeup', label: '调休', name: workdays[d], manual: false });
|
items.push({ date: d, type: 'makeup', label: '调休', name: workdays[d], manual: false });
|
||||||
});
|
});
|
||||||
Object.keys(manual).forEach(function(d) {
|
Object.keys(manual).forEach(function(d) {
|
||||||
|
const manualLabels = { holiday: '放假', makeup: '补课', pre_holiday: '节前上课' };
|
||||||
items.push({
|
items.push({
|
||||||
date: d,
|
date: d,
|
||||||
type: manual[d].type,
|
type: manual[d].type,
|
||||||
label: manual[d].type === 'holiday' ? '放假' : '补课',
|
label: manualLabels[manual[d].type] || manual[d].type,
|
||||||
name: manual[d].note || '',
|
name: manual[d].note || '',
|
||||||
manual: true
|
manual: true
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user