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 3s
PR Preview / test (pull_request) Successful in 5s
Test / e2e-test (push) Has been cancelled
PR Preview / deploy-preview (pull_request) Successful in 13s
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 3s
PR Preview / test (pull_request) Successful in 5s
Test / e2e-test (push) Has been cancelled
PR Preview / deploy-preview (pull_request) Successful in 13s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -279,6 +279,18 @@ def init_db():
|
|||||||
for old_name, new_name in _recipe_renames.items():
|
for old_name, new_name in _recipe_renames.items():
|
||||||
c.execute("UPDATE recipes SET name = ? WHERE name = ?", (new_name, old_name))
|
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
|
# Seed admin user if no users exist
|
||||||
count = c.execute("SELECT COUNT(*) FROM users").fetchone()[0]
|
count = c.execute("SELECT COUNT(*) FROM users").fetchone()[0]
|
||||||
if count == 0:
|
if count == 0:
|
||||||
|
|||||||
@@ -77,18 +77,18 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="th-name">配方名</th>
|
<th class="th-name">配方名</th>
|
||||||
<th class="th-kit">单买</th>
|
|
||||||
<th v-for="ka in kitAnalysis" :key="ka.id" class="th-kit">{{ ka.name }}</th>
|
<th v-for="ka in kitAnalysis" :key="ka.id" class="th-kit">{{ ka.name }}</th>
|
||||||
|
<th class="th-kit">单买</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="row in crossComparison" :key="row.id">
|
<tr v-for="row in crossComparison" :key="row.id">
|
||||||
<td class="td-name">{{ row.name }}</td>
|
<td class="td-name">{{ row.name }}</td>
|
||||||
<td class="td-cost original">{{ fmtPrice(row.originalCost) }}</td>
|
|
||||||
<td v-for="ka in kitAnalysis" :key="ka.id" :class="row.costs[ka.id] != null ? 'td-kit-available' : 'td-kit-na'">
|
<td v-for="ka in kitAnalysis" :key="ka.id" :class="row.costs[ka.id] != null ? 'td-kit-available' : 'td-kit-na'">
|
||||||
<template v-if="row.costs[ka.id] != null">{{ fmtPrice(row.costs[ka.id]) }}</template>
|
<template v-if="row.costs[ka.id] != null">{{ fmtPrice(row.costs[ka.id]) }}</template>
|
||||||
<template v-else><span class="na">—</span></template>
|
<template v-else><span class="na">—</span></template>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="td-cost original">{{ fmtPrice(row.originalCost) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user