Negative category count (minus number) after unlisting/deleting

Yes, that’s the problem. I can reproduce the issue on my test site. Unlisting a topic removes the topic from its category’s topic stats. If you then delete the unlisted topic, it is again subtracted from its category’s topic stats. This means that unlisting and then deleting a single topic is counted as removing two topics from the stats.

Discourse runs a CategoryStats background job once every 24 hours. When that job runs, the stats for your category should get fixed. If you have access to your site’s rails console, and don’t want to wait for the job to run, you can run the command manually with:

Category.update_stats

I tested this on my own site. Running that command fixed the issue for me.

4 Likes