回滚到 982f0df:重构共享逻辑并修复值班提醒回执去重

This commit is contained in:
2026-11-22 23:17:01 +08:00
parent 1bb8f73f1e
commit cf97de9423
8 changed files with 42 additions and 314 deletions
+2 -4
View File
@@ -13,7 +13,7 @@ from fastapi import Depends, HTTPException, Query
from pydantic import BaseModel, Field, field_validator
from sqlalchemy import insert, select
from .duty import BEIJING
from .duty import BEIJING, week_type_on
from .models import center_duty_leaves, users
from .security import now_ms
@@ -68,9 +68,7 @@ def _monday_for(value: date) -> date:
def _week_type(schedule: dict, week_start: date) -> str:
week_delta = (_monday_for(week_start) - schedule["anchor_day"]).days // 7
odd = week_delta % 2 == 0
return schedule["anchor_week"] if odd else ("even" if schedule["anchor_week"] == "odd" else "odd")
return week_type_on(schedule, week_start)
def _at_ms(day: date, clock: str) -> int: