Why post count differs on admin page and about.json?


(Ivan Rapekas) #1

Hi, I found that post count for the latest 30 days in about.json and admin page are different 6242 vs 5562:

%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5
%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

Why? Topic count is equal. I tried to do some calculations but did not find any logic.

Discourse 1.9.4


(Simon Cossar) #2

The post count is calculated differently on the About page than it is on the Admin Dashboard. On the About page the post count is calculated with Post.count. The query that is used for the 7 day and 30 day periods is similar to this. It will return all posts, including PMs. On the Admin Dashboard the post count is calculated with this:

Post.public_posts.where(post_type: Post.types[:regular])

This will exclude private messages from the post count. It will also exclude moderator action, small action, and whisper posts from the post count.


(Ivan Rapekas) #3

@Simon_Cossar, thank you for the explanation!

We used to use about.json for statistics on our website. Now we can explain the difference :slight_smile:. Topics number is approx.equal, and posts number includes small actions (assignments and un-assigments, usually +2 per topic, etc).

Solved for me,
Ivan