From 4dfe1b7bb4c87f480b2594601774061d722f938a Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Mon, 13 Apr 2026 23:24:43 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8D=95=E4=B9=B0=E6=88=90=E6=9C=AC?= =?UTF-8?q?=E7=A7=BB=E5=88=B0=E5=85=A8=E7=B2=BE=E6=B2=B9=E5=90=8E=E9=9D=A2?= =?UTF-8?q?=EF=BC=9B=E9=85=8D=E6=96=B9=E5=90=8D=E6=9C=AB=E5=B0=BE=E9=98=BF?= =?UTF-8?q?=E6=8B=89=E4=BC=AF=E6=95=B0=E5=AD=97=E8=BD=AC=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/database.py | 12 ++++++++++++ frontend/src/views/KitExport.vue | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/database.py b/backend/database.py index 4942e39..b6bec05 100644 --- a/backend/database.py +++ b/backend/database.py @@ -279,6 +279,18 @@ def init_db(): for old_name, new_name in _recipe_renames.items(): c.execute("UPDATE recipes SET name = ? WHERE name = ?", (new_name, old_name)) + # Migration: trailing Arabic numerals → Chinese numerals in recipe names + _num_map = {'1': '一', '2': '二', '3': '三', '4': '四', '5': '五', '6': '六', '7': '七', '8': '八', '9': '九'} + _trailing_num_recipes = c.execute("SELECT id, name FROM recipes").fetchall() + for row in _trailing_num_recipes: + import re as _re + m = _re.search(r'(\d+)$', row['name']) + if m: + digits = m.group(1) + chinese = ''.join(_num_map.get(d, d) for d in digits) + new_name = row['name'][:m.start()] + chinese + c.execute("UPDATE recipes SET name = ? WHERE id = ?", (new_name, row['id'])) + # Seed admin user if no users exist count = c.execute("SELECT COUNT(*) FROM users").fetchone()[0] if count == 0: diff --git a/frontend/src/views/KitExport.vue b/frontend/src/views/KitExport.vue index b9b9629..e65b0f1 100644 --- a/frontend/src/views/KitExport.vue +++ b/frontend/src/views/KitExport.vue @@ -77,18 +77,18 @@ 配方名 - 单买 {{ ka.name }} + 单买 {{ row.name }} - {{ fmtPrice(row.originalCost) }} + {{ fmtPrice(row.originalCost) }}