Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Period comparison badge shows wrong percentage for decreases (100 → 50 shows ↓100%)

未关闭 适合新手
#526 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@sarmah-rup 已经在做这个了。

开始于 2026年9月29日。

  • #527 来自 @sarmah-rup —— 未关闭
  • #531 来自 @Tyagiquamar —— 未关闭

评估

难度
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

  1. 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.
  2. 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 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Openpanel-dev/openpanel 的其他 Issue

查看 Openpanel-dev/openpanel 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。