考勤记录扣分列显示实际扣分数

1. 新增/更新考勤扣分时记录关联的扣分记录ID(deduction_record_id)
2. 考勤记录查询关联扣分记录,返回扣分数与撤销状态;旧记录按考勤记录ID回查兜底
3. 前端扣分列显示"扣X分 / 扣X分(已撤销)",无扣分显示"-"
This commit is contained in:
canglan committed 2026-11-26 09:56:21 +08:00
1 parent 0ac933a3a5
commit a7304d151e
4 files changed
+38 -9

No files matched your search

+3 -3
View File
@@ -127,7 +127,7 @@ class AttendanceService:
recorder_name = user.get("real_name", "班主任") if user else "班主任"
# 使用中文状态
status_text = ATTENDANCE_STATUS_MAP.get(status, status)
await ConductModel.create_record(
deduction_record_id = await ConductModel.create_record(
student_id=student_id,
points_change=points_change,
reason=f"考勤:{status_text}",
@@ -141,8 +141,8 @@ class AttendanceService:
# 更新学生总分
await StudentModel.update_total_points(student_id, points_change)
# 标记已应用扣分
await AttendanceModel.mark_deduction_applied(attendance_id)
# 标记已应用扣分(并记录扣分记录ID)
await AttendanceModel.mark_deduction_applied(attendance_id, deduction_record_id)
logger.info(f"用户[{recorder_id}] 添加考勤记录[{attendance_id}] -> {status}")
return {"success": True, "message": "考勤记录添加成功"}