fix: 对齐领券成功率分母口径 #101
Reference in New Issue
Block a user
Delete Branch "codex/coupon-rate-exclude-abandoned"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
改动说明
验证
依赖后端:WonderableAI/shaguabijia-app-server#213,请同步发布。
🤖 review-pr 深审结论
🟢 可合并 · 0.9 — 领券成功率前端对齐 server#213 新分母口径。合并最新
main后隔离 worktree 实跑tsc --noEmit(strict)退出 0,type-safe。纯展示层,防御式安全。改动(3 文件 +17/-3)
src/lib/types.ts:DashboardOverview.coupon加abandoned/success_denominator—— 对接 server#213 后端字段(铁律1 跨仓契约 ✓)。dashboard/page.tsx:大盘「领券成功率」提示改为all_success ÷(started − abandoned)并显示实际分母;success_rate值直接取后端(已是新口径)。coupon-data/page.tsx:PointScorePopover对「中途退出且退出前无单券结果(status=abandoned&0/0)」显示「0.0%(退出前无结果)」;缺埋点(null)仍显示-,不误报 0%。构建 / 类型(已实跑,诚实)
tsc --noEmit(TS 5.9.3,strict)→ 退出 0,零类型错误。正面点
fmtInt对null/undefined → '--',即使后端 #213 未上线也不崩(本 PR 已声明「依赖 #213 同步发布」)。0/0结果 →0.0%;缺埋点null→-。关注(低)
types.ts里abandoned/success_denominator标必填,但要 server#213 上线后才保证有;运行时?.+fmtInt已兜底不崩,待 #213 合并即一致。建议与 #213 同步发布(body 已注明)。建议
🤖 自动深审 · 全程只读 · 合并 base 后隔离 worktree 实跑 tsc
🤖 review-pr 深审结论(增量复审 @b8363b31)
🟢 可合并 · 0.9 — 本次「保留跳过单券明细入口」消费 server#213 新增的
point_event_count,把「退出前无结果」与「有跳过事件但无有效结果」区分开。合并最新main后tsc --noEmit(strict)退出 0、type-safe、除零安全。本次增量(
7d4de22e → b8363b31,3 文件 +29/-8)CouponDataRow+point_event_count?: number(可选,消费 #213 新字段,向后兼容)。PointScorePopover:0/0时不再早退-,改按有无事件分流:hasPointDetails = (point_event_count ?? 0) > 0。scoreColor加point_total_count > 0 &&守卫,避免0===0误判为完成态色。除零 / 边界核对
0/0分支硬编码0.0%(不做除法);仅point_total_count > 0时才走success/total*100(早退保证),无 NaN / 除零。构建 / 类型(已实跑,诚实)
tsc --noEmit(TS 5.9.3,strict)→ 退出 0,零类型错误。关注(低,同前)
point_event_count依赖 #213 后端;?? 0兜底不崩。建议 #213 ↔ #101 同步发布。🤖 自动深审 · 增量复审 · 合并 base 后隔离 worktree 实跑 tsc