fix(roi):修复 working_hours 为空数组 [] 时被错误识别为 None 的问题,导致全天模式失效。
Some checks failed
Python Test / test (push) Has been cancelled
Some checks failed
Python Test / test (push) Has been cancelled
- 修改 `api/roi.py` 中的判断逻辑:使用 `is not None` 替代 truthy 检查,确保 `[]` 能正确序列化并存入数据库 - 更新 `config.yaml` 全局默认值为 `working_hours: []`,表示“全天开启”
This commit is contained in:
@@ -108,7 +108,7 @@ def add_roi(
|
||||
):
|
||||
import json
|
||||
|
||||
working_hours_json = json.dumps(request.working_hours) if request.working_hours else None
|
||||
working_hours_json = json.dumps(request.working_hours) if request.working_hours is not None else None
|
||||
|
||||
roi = create_roi(
|
||||
db,
|
||||
@@ -153,7 +153,7 @@ def modify_roi(
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
import json
|
||||
working_hours_json = json.dumps(request.working_hours) if request.working_hours else None
|
||||
working_hours_json = json.dumps(request.working_hours) if request.working_hours is not None else None
|
||||
|
||||
roi = update_roi(
|
||||
db,
|
||||
|
||||
Reference in New Issue
Block a user