Files
cmautobuy/docs/task/136-pdd任务列表显示店铺名和最新执行用时.md
T

51 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# #136 PDD 任务列表显示店铺名和最新执行用时
- 工单号:#136
- 类型:功能 / 数据库迁移
- 父级:#1
- 版本:MVP #2
- 状态:已完成
- 日期:2026-08-11
- Gitea:<http://ilaer.eicp.net:8418/chengma/cmautobuy/issues/136>
## 背景与目标
任务列表直接展示采集到的店铺名和最近一次采集或采购用时,方便采购人员快速判断任务结果和性能。
## 最终方案
SQLite 升级到 v5,增加轻量 `shop_name` 摘要列并从有效的历史 `pdd_data.shop_name` 回填。保存新结果时同步该摘要。列表查询在同一条 SQL 中关联最新一条 `task_runs`,返回执行状态和整秒用时,不读取完整 JSON,也不逐行查询。
## 改了哪些
- `client/src/db_schema.py`:增加 v5 迁移和历史店铺名回填。
- `client/src/task_repository.py`:保存店铺名,并用单条列表 SQL 查询最新执行用时。
- `client/src/task_models.py`:扩展轻量任务摘要。
- `client/src/pdd_ui.py`、`client/src/pdd_ui_event.py`:增加“店铺名”“用时”列。
- `client/test/`:覆盖迁移、摘要、负用时保护和表格列。
- `docs/client/03-data-model.md`、`05-ui-specification.md`:更新稳定基线。
## 验收结果
| 验收标准 | 结果 |
|---|---|
| SQLite v5 增加店铺名并安全回填历史有效 JSON | 通过 |
| 保存采集或采购结果时同步店铺名摘要 | 通过 |
| 列表单条 SQL 获取最新执行记录,不读取完整 pdd_data | 通过 |
| 已结束显示整数秒,执行中显示“进行中”,负值按 0 秒 | 通过 |
| 表格按确认顺序显示 11 列且空表仍保留 | 通过 |
## 测试
- 执行的命令:在 `client` 目录分别运行 `test_db.py`、`test_task_repository.py`、`test_pdd_ui.py`、`test_pdd_ui_event.py` 的 unittest discover。
- 结果:相关测试通过;Client 全量 377 项测试通过。
- **没验证到的部分**:未用生产 SQLite 副本执行迁移;未用真机完成一次采集和采购后人工检查列表。
## 相关提交
- `e354ddd` 任务列表显示店铺名和执行用时
## 用户验收
- 2026-08-11:用户确认通过验收。