`/leaderboard`, the page and the share image say "be the first" for a program that hasn't started

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
84/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
backend

调研方向

从 src/messages.ts 中的 leaderboardMessage(第 136 行)和空榜文案(第 167-173 行)开始:消息需要按今天传入 final 的方式传入一个 started/not-started 标志。src/page.ts 已经构建 statusLine,src/card.ts 构建 boardState,所以把这个状态贯穿到两者中,并且在 src/commands.ts(leaderboard 分支,第 80 行)中,当程序尚未开始时跳过 GitHub 搜索。先在 test/messages.test.ts、test/card.test.ts 和 test/page.test.ts 中写会失败的测试;完成标准是三个界面都显示开始日期,并且 npm test 和 npm run typecheck 通过。

由索引模型根据 Issue 内容生成。

描述

bug good first issue

Pick CODERCOPS December 2026 in /leaderboard and the reply says:

No merged PRs counted yet. Pick a starter issue and be the first.

But a PR merged now counts for November, not December. The program's page and its share image say the same thing, right under their own "Starts Dec 1, 2026" and "STARTS DEC 1" labels. oss.codercops.com/leaderboard/2026-12 shows it today. The text comes from three places:

  • src/messages.ts, line 172. leaderboardMessage only knows whether a program has ended (final), not whether it has started.
  • src/page.ts, line 245, the empty board on the page
  • src/card.ts, line 219, the board image at /leaderboard/2026-12.png

The /leaderboard reply also searches GitHub for a date range in the future (getLeaderboard in src/commands.ts, line 83). Nothing can match, and it uses up a request from GitHub's search limit (30 a minute with a token).

What to do

  • For a program that hasn't started, say when it starts instead, for example "Starts Dec 1, 2026 (UTC). PRs merged before then don't count for it." in all three places. The page and the card already know the status (statusLine in src/page.ts, line 23, and boardState in src/card.ts, line 130). leaderboardMessage needs it passed in, the way final is today.
  • In the leaderboard command, don't search GitHub for a program that hasn't started. An empty board is enough.

Where to look

  • src/messages.ts: leaderboardMessage (line 136) and the empty board text (lines 167 to 173)
  • src/page.ts: statusLine (line 23) and line 245
  • src/card.ts: boardState (line 130) and lines 217 to 219
  • src/commands.ts: the leaderboard case (line 80)
  • test/messages.test.ts: the empty board tests (lines 277 and 286); test/card.test.ts: the empty state test (line 160); test/page.test.ts: statusLine (line 51)

Acceptance criteria

  • For a program that hasn't started, the reply, the page and the image say when it starts and don't say "be the first"
  • Running and ended programs read the same as now
  • /leaderboard for a program that hasn't started makes no GitHub search request
  • Tests that fail on the current code
  • npm run typecheck and npm test pass

How to test

The tests already have an upcoming program to copy (test/card.test.ts, line 372, uses one starting in 2100). For the command, run runCommand with the program option set to an upcoming one and check with mockFetch that no /search/issues call was made. By hand: npm run dev, then open http://localhost:8787/leaderboard/2026-12 and http://localhost:8787/leaderboard/2026-12.png. Both work without any secrets.


Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #152 in the description.

主要语言
TypeScript
星标
0
派生
1
平均合并
2 小时 38 分钟
30 天内合并 PR
73

环境准备

从这里开始

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

codercops/discord-bot 的其他 Issue

查看 codercops/discord-bot 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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