How to re-calculate the top users stats?

(Angel Raul Molina Muñoz) #1

Hi, guys! before all I’m so sorry if the question is duplicated, I just used the search box but I don’t found any related topic.

In my community, recently we banned some toxic users, there is no problem, the problem is that now the community are asking me to “delete” those users from the “top users” view, I mean this one:

I tried with resetting the stats
User.find(xxxx).user_stat.update(topics_entered: 0, time_read: 0, days_visited: 0, posts_read_count: 0, likes_given: 0, likes_received: 0, topic_reply_count: 0, post_count: 0, topic_count: 0, bounce_score: 0)
and then rebuilding the app ./launcher rebuild app without success.

So, what is the best way to do it?

Thank you guys.

(Vinoth Kannan) #2

(Angel Raul Molina Muñoz) #3

Hey, thank you, but I tried that too and still not working :disappointed:

(Angel Raul Molina Muñoz) #4

I found a solution! After checking the source code I found DirectoryItem and with the following query I solved my problem: DirectoryItem.where(user_id: USER_ID).destroy_all

(Robin Ward) #5