Period comparison badge shows wrong percentage for decreases (100 → 50 shows ↓100%)
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 85/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- analytics
调研方向
从 packages/common/src/get-previous-metric.ts 开始,检查 getPreviousMetric,该 issue 指出它是减少量计算错误的来源。完成标准是减少量根据前一个周期进行测量:100 到 50 显示 ↓50%,100 到 25 显示 ↓75%,100 到 0 显示 ↓100%。
由索引模型根据 Issue 内容生成。
描述
When a metric goes down compared to the previous period, the percentage badge overstates the drop. Going from 100 to 50 visitors shows ↓100%, going from 100 to 25 shows ↓300%, and going from 100 to 0 shows no percentage at all.
Steps to reproduce
- Open a project overview (or any chart with "compare to previous period" on) where a metric dropped, for example 100 last period and 50 this period.
- Look at the diff badge on the metric card or in the tooltip.
Expected: ↓50% (and ↓100% when it drops to 0).
Actual: ↓100% (↓300% for 100 → 25, and no badge for 100 → 0).
Cause: getPreviousMetric in packages/common/src/get-previous-metric.ts uses current / previous - 1 for increases but previous / current - 1 for decreases, so the size of a decrease is measured against the new value instead of the previous one. When current is 0 that divides by zero and the diff becomes null.
- 主要语言
- TypeScript
- 星标
- 7.1k
- 派生
- 510
- 平均合并
- 5 天 13 小时
- 30 天内合并 PR
- 6
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Openpanel-dev/openpanel 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
Openpanel-dev/openpanel#532 ·
维护者通常 1 天内回复
-
Self-hosted missing op1-replay.js可能已有人在做 @houstona 于 10 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
Openpanel-dev/openpanel#512 · 1 条评论 ·
维护者通常 1 天内回复
-
login page needs refinement可能已有人在做 @anandghegde 于 24 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
Openpanel-dev/openpanel#495 ·
维护者通常 1 天内回复
-
Session replay: early chunks saved under the wrong session可能已有人在做 @rjocoleman 今天认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
Openpanel-dev/openpanel#537 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 22/100
Openpanel-dev/openpanel#536 ·
维护者通常 1 天内回复
查看 Openpanel-dev/openpanel 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
core
难度 2/5 1-3 小时 新手友好度 70/100
vectorize-io/hindsight#5457 ·
维护者通常 1 天内回复
-
beginner friendly community contributions-welcome good first issue hacktoberfest help wanted testing up-for-grabs
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
lukilabs/beautiful-mermaid#160 ·
-
难度 2/5 1-3 小时 新手友好度 66/100
rescript-lang/rescript-lang.org#1420 ·
维护者通常 2 天内回复