fix(backend): _recalc_product_location 修复 func.or_() → or_()
func 是 SQL 函数调用(如 func.now()),不能替代 WHERE 条件中的 or_ 运算符。 这会导致结束协助分支时 SQL 抛错 500。
This commit is contained in:
@ -46,7 +46,7 @@ async def _recalc_product_location(
|
||||
优先级:
|
||||
WIP > PENDING > COMPLETED/ARCHIVED > None
|
||||
"""
|
||||
from sqlalchemy import select as sa_select, case as sa_case, func as sa_func
|
||||
from sqlalchemy import select as sa_select, case as sa_case, or_ as sa_or_
|
||||
|
||||
product_result = await db.execute(
|
||||
sa_select(Product).where(Product.id == product_id)
|
||||
@ -60,7 +60,7 @@ async def _recalc_product_location(
|
||||
sa_select(Task)
|
||||
.where(
|
||||
Task.product_id == product_id,
|
||||
sa_func.or_(
|
||||
sa_or_(
|
||||
Task.parent_task_id.is_(None),
|
||||
Task.task_type.in_(["TRANSFER", "RECOVERY"]),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user