feat: 累积功能变更 — 聊天集成、租户管理、小程序更新、ETL 增强、迁移脚本
包含多个会话的累积代码变更: - backend: AI 聊天服务、触发器调度、认证增强、WebSocket、调度器最小间隔 - admin-web: ETL 状态页、任务管理、调度配置、登录优化 - miniprogram: 看板页面、聊天集成、UI 组件、导航更新 - etl: DWS 新任务(finance_area_daily/board_cache)、连接器增强 - tenant-admin: 项目初始化 - db: 19 个迁移脚本(etl_feiqiu 11 + zqyy_app 8) - packages/shared: 枚举和工具函数更新 - tools: 数据库工具、报表生成、健康检查 - docs: PRD/架构/部署/合约文档更新 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
52
docs/prd/Neo_Specs/review-audit/P6-NS1-03.md
Normal file
52
docs/prd/Neo_Specs/review-audit/P6-NS1-03.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# P6→NS1/RNS1 缺失项 #3:置顶任务排序规则
|
||||
|
||||
## 简要结论
|
||||
- 状态:✅ 已解决
|
||||
- 风险等级:🟡 低
|
||||
- 后端已实现「置顶优先 → 优先级分数降序 → 创建时间升序」的排序规则,与 P6 定义的排序意图一致。
|
||||
|
||||
## 详细审查
|
||||
|
||||
### 审查范围
|
||||
- `apps/backend/app/services/task_manager.py` — `get_task_list_v2()` 函数中的 SQL ORDER BY
|
||||
- `apps/miniprogram/miniprogram/pages/task-list/task-list.ts` — 前端分组逻辑
|
||||
|
||||
### 发现
|
||||
|
||||
**后端排序(已实现):**
|
||||
|
||||
`task_manager.py` 的 `get_task_list_v2()` 中 SQL 查询明确定义了排序规则:
|
||||
|
||||
```sql
|
||||
ORDER BY is_pinned DESC,
|
||||
priority_score DESC NULLS LAST,
|
||||
created_at ASC
|
||||
```
|
||||
|
||||
- `is_pinned DESC`:置顶任务排在最前
|
||||
- `priority_score DESC NULLS LAST`:非置顶任务按优先级分数降序(高优先级在前)
|
||||
- `created_at ASC`:同优先级按创建时间升序(先创建的在前)
|
||||
|
||||
**前端分组(已实现):**
|
||||
|
||||
`task-list.ts` 的 `loadData()` 中将后端返回的列表按状态分组:
|
||||
```typescript
|
||||
const pinnedTasks = enriched.filter((t) => t.isPinned && !t.isAbandoned)
|
||||
const normalTasks = enriched.filter((t) => !t.isPinned && !t.isAbandoned && t.status === 'pending')
|
||||
const abandonedTasks = enriched.filter((t) => t.isAbandoned)
|
||||
```
|
||||
|
||||
WXML 中按「📌 置顶 → 正常任务 → 已放弃」三组依次渲染,组内保持后端返回顺序。
|
||||
|
||||
### 证据
|
||||
|
||||
后端 SQL(task_manager.py 第 560-564 行):
|
||||
```sql
|
||||
ORDER BY is_pinned DESC,
|
||||
priority_score DESC NULLS LAST,
|
||||
created_at ASC
|
||||
LIMIT %s OFFSET %s
|
||||
```
|
||||
|
||||
### 建议(如未完全解决)
|
||||
- P6 提到「置顶任务按置顶时间倒序」,当前实现是 `is_pinned DESC`(布尔值),多个置顶任务之间的排序依赖 `priority_score`。如需严格按置顶时间排序,需在 `coach_tasks` 表中添加 `pinned_at` 时间戳字段并在 ORDER BY 中使用。当前实现在功能上可接受,但与 P6 的精确定义有微小差异。
|
||||
Reference in New Issue
Block a user