Wrong post count in profile


#1

Wrong post count is shown in the profile of a new user (joined a week ago).

Profile screenshot: (it shows 3 posts)

Clicking on proflle - > replies shows more posts

NOTE:

  1. These are not private posts. These are public posts.

$200 to fix a bug (wrong post count in profile)
#2

Isn’t this a bug.
Accurate post count is really important since we pay the moderators per post


Paying for content
(Jeff Atwood) #3

Checking here on meta I can’t repro.

  • new user with 1 post… shows as 1 post in account summary
  • new user with 2 posts… shows as 2 posts in account summary
  • new user with 1 topic, 1 reply… shows as 1 topic, 1 post in account summary

You need to be able to repro this on try.discourse.org or give us better repro steps.


#4

@codinghorror
Unfortunately I’m not able to reproduce it on my own site.
I think its the second time I’m noticing irregularities in post count.
So, not really sure what is causing this.
This isn’t happening for all users. So, couldn’t reproduce it.


#5

2 posts were split to a new topic: Paying for content


(Jeff Atwood) #6

OK if you can isolate the users where this is happening, then we can help track it down.


#7

Sure I’m ready go to any extent to fix this.

  1. If anyone from the Discourse team would like to take admin/mod access on my site to work on this - I can provide access.

  2. What other details would you be needing. I’m ready to isolate the issue, but I’m not quite sure what all stuffs to check.


(Joseph Coates) #8

Just a stab in the dark… Could deleted posts be counting for -1 (rather than 0) in the count?

User creates seven posts, two are deleted, thus the correct count should be five. However, the deleted posts each count for -1 thus the displayed count is 3.


#9

I have seen -1 as post count for some users in the past (is this normal) ?

For this user:
There are 8 deleted posts (7 private and 1 public post)
It shows 1 topic created 1 post created.

Topic created count = correct which is 1.
But posts created = 7 (but shows as 1 in profile)


#10

I just found a user in my site who has 10+ topics and lots of posts.
But in his profile, it shows as 0 posts and 0 topics.
The user is a blocked user.
But I unblocked the user - and that didn’t make any difference either.

NOTE:
If anyone from the Discourse team would like to have a look at this - I’m more than happy to co-operate and provide admin/mod access.


#11

I found another user with incorrect post count. :frowning:

NOTE:
I’m going to disable all the plugins and check if that is fixing the issue or not.
I will update my progress here.


(Felix Freiberger) #12

We’ve seen a similar phenomenon on our instances and solved it by running a command made for bulk importers.

The post count is stored in the database and is only updated, not recalculated, when changes are made. Most likely, there is an edge case somewhere, causing these counts to be updated incorrectly. This issue is then never corrected automatically.

This might be related to the recurring support cases where users cannot be deleted because they still appear to have posts.

Given that the posts counts were way off in one of our instances, at least one such edge case is probably triggered by our yearly cleanup, so maybe something is off when moving posts between categories with different permissions (for users which may have been disabled)?


#13

Thanks @fefrei

Yes I too faced issue while deleting users in the past stating posts are there or something similar.

I’m going to try your fix.


#14

@fefrei
I’m little lost in that big thread.
Could you paste here the command that I should run to fix this?


(Felix Freiberger) #15

Here you go:

Run this within the container (after /var/discourse/launcher enter app).

Be sure to take a backup first. It worked for us, but this is certainly a risky operation.


#16

@fefrei

So, its a single command right:

rake import:ensure_consistency


(Felix Freiberger) #17

Yes, to be run within the container :slight_smile:


#18

@fefrei
If this really fixes the issue, I really owe you big time. :slight_smile:


#19

@fefrei

I ran the command and it messed up the “total topics” count.
Total posts is fixed now though.


#20

Update:

I ran the below command:
./launcher enter app
rake import:ensure_consistency
It didn’t fix things.

I tried disabling all my installed plugins.
That also didn’t fix the issue.