# How to re-calculate the top users stats?

**URL:** https://meta.discourse.org/t/how-to-re-calculate-the-top-users-stats/55655
**Category:** Support
**Created:** [1월 12, 2017, 5:08오후 UTC](https://meta.discourse.org/t/how-to-re-calculate-the-top-users-stats/55655 "2017-01-12T17:08:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![skozz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/skozz/32/119704_2.png) [@skozz](https://meta.discourse.org/u/skozz)
#### Post date: [1월 12, 2017, 5:08오후 UTC](https://meta.discourse.org/t/how-to-re-calculate-the-top-users-stats/55655/1 "2017-01-12T17:08:42Z")

</div>

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:

 ![](https://global.discourse-cdn.com/meta/original/3X/6/a/6ae8e0014281716cb357f33fe50b03319db2511f.png)

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.

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [1월 12, 2017, 6:19오후 UTC](https://meta.discourse.org/t/how-to-re-calculate-the-top-users-stats/55655/2 "2017-01-12T18:19:46Z")

</div>

> [@User stats wrong/not up to date](https://meta.discourse.org/t/user-stats-wrong-not-up-to-date/54429/2):
>
> See `/sidekiq`

> [@User stats wrong/not up to date](https://meta.discourse.org/t/user-stats-wrong-not-up-to-date/54429):
>
> I noticed something’s off with the stats of the Users page at my small forum (it’s really small, yes): [https://discorsi.openarchaeology.eu/users/](https://discorsi.openarchaeology.eu/users/) If I’m not mistaken, various numbers shown for the default view (last week) and other views (last month) are wrong or not up to date, showing actions (likes given and received, messages) that do not reflect the actual activity of those users. The view for last year seems correct though. I’m not sure there is a way to force a reset of the stats?

---

<div class="post-metadata">

### Author: ![skozz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/skozz/32/119704_2.png) [@skozz](https://meta.discourse.org/u/skozz)
#### Post date: [1월 12, 2017, 8:31오후 UTC](https://meta.discourse.org/t/how-to-re-calculate-the-top-users-stats/55655/3 "2017-01-12T20:31:42Z")

</div>

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

---

<div class="post-metadata">

### Author: ![skozz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/skozz/32/119704_2.png) [@skozz](https://meta.discourse.org/u/skozz)
#### Post date: [1월 12, 2017, 9:34오후 UTC](https://meta.discourse.org/t/how-to-re-calculate-the-top-users-stats/55655/4 "2017-01-12T21:34:37Z")

</div>

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`

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [1월 13, 2017, 4:26오후 UTC](https://meta.discourse.org/t/how-to-re-calculate-the-top-users-stats/55655/5 "2017-01-13T16:26:39Z")

</div>


