fix: 填报检查统计所有经理 (不限于已绑定企微)

之前只统计 wecom_userid IS NOT NULL 的经理导致始终 0/0,
现在统计全员,仅推送消息时跳过未绑定用户。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-26 16:10:17 +08:00
parent e69d962521
commit 989c41da8c
+2 -5
View File
@@ -15,15 +15,12 @@ async def check_daily_reporting(db: AsyncSession) -> dict:
if weekday >= 5: # Skip weekends
return {"status": "weekend", "date": str(today)}
# Get all managers with wecom_userid
# Get all managers (stats include everyone)
result = await db.execute(
select(User).where(User.role == "manager", User.wecom_userid.isnot(None))
select(User).where(User.role == "manager")
)
managers = result.scalars().all()
if not managers:
return {"status": "ok", "date": str(today), "total_managers": 0, "reported": 0, "not_reported": 0}
# Get managers who have reported today
reported_visits = await db.execute(
select(Visit.manager_id).where(Visit.visit_date == today)