fix: 修改公共配方中文名时自动重新翻译英文名
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Failing after 3m5s
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Failing after 3m5s
改名但没手动指定英文名时,自动用 auto_translate 重新生成。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -858,6 +858,9 @@ def update_recipe(recipe_id: int, update: RecipeUpdate, user=Depends(get_current
|
|||||||
|
|
||||||
if update.name is not None:
|
if update.name is not None:
|
||||||
c.execute("UPDATE recipes SET name = ? WHERE id = ?", (update.name, recipe_id))
|
c.execute("UPDATE recipes SET name = ? WHERE id = ?", (update.name, recipe_id))
|
||||||
|
# Re-translate en_name if name changed and no explicit en_name provided
|
||||||
|
if update.en_name is None:
|
||||||
|
c.execute("UPDATE recipes SET en_name = ? WHERE id = ?", (auto_translate(update.name), recipe_id))
|
||||||
if update.note is not None:
|
if update.note is not None:
|
||||||
c.execute("UPDATE recipes SET note = ? WHERE id = ?", (update.note, recipe_id))
|
c.execute("UPDATE recipes SET note = ? WHERE id = ?", (update.note, recipe_id))
|
||||||
if update.en_name is not None:
|
if update.en_name is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user