feat: 消除同访草案机制,改为查询时通过 companions 数组覆盖
- 删除 POST /visits 中的草案创建逻辑(不再创建空拜访记录) - 周报查询:manager 角色也显示同访的拜访记录 - 亮灯表覆盖:同访人也算客户拜访覆盖(UNION companions) - 填报进度:同访人也算今日已填报 - 清理已有 2 条空草案记录 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -194,22 +194,6 @@ async def create_visit(
|
||||
)
|
||||
db.add(log)
|
||||
|
||||
# Create draft copies for companions
|
||||
for companion_id in data.companions:
|
||||
if companion_id != uuid.UUID(current_user["user_id"]):
|
||||
draft = Visit(
|
||||
customer_id=data.customer_id,
|
||||
visit_date=parse_date(data.visit_date),
|
||||
visit_method=data.visit_method,
|
||||
time_range=data.time_range,
|
||||
communication_content="", # Leave blank for companion to fill
|
||||
customer_demand="",
|
||||
companions=[],
|
||||
photos=[],
|
||||
manager_id=companion_id,
|
||||
)
|
||||
db.add(draft)
|
||||
|
||||
await db.commit()
|
||||
await db.refresh(visit)
|
||||
return await _enrich_visit(visit, db)
|
||||
|
||||
Reference in New Issue
Block a user