Skip to content

fix(web): count topic prompts by topic_id instead of category name - #617

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
d180:fix/topic-count-by-topic-id
Aug 3, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
d180:fix/topic-count-by-topic-id

Conversation

@d180

@d180 d180 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Renaming a topic on Manage Topics zeroed its prompt count: getPromptCountByTopic matched prompts by the legacy prompts.category text field, which still held the topic's old name after a rename.
  • The Topics leaderboard, which counts by topic_id, kept showing the correct number — so the two surfaces disagreed.
  • Switches getPromptCountByTopic to filter by topic_id instead of category name (the smaller, safer of the two fixes suggested in the issue), and updates its caller in the Manage Topics page to pass the topic's id instead of its name.

Related issue

Closes #594

Type of change

  • fix — Bug fix

Checklist

  • Branch follows the naming convention (fix/)
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preferred fix from the issue, applied cleanly at both the action and its only caller. Thanks!

@gkhngyk
gkhngyk merged commit 5ba5ce9 into ansvisor:main Aug 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renaming a topic zeroes its prompt count on the Manage Topics page

2 participants