# Actualizando el recuento de temas en categorías después de eliminación masiva y temas/publicaciones faltantes

**URL:** https://meta.discourse.org/t/updating-topic-count-in-categories-after-bulk-delete-missing-topics-posts/89355
**Category:** Support
**Created:** [7 Junio, 2018 13:03 UTC](https://meta.discourse.org/t/updating-topic-count-in-categories-after-bulk-delete-missing-topics-posts/89355 "2018-06-07T13:03:53Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [7 Junio, 2018 14:50 UTC](https://meta.discourse.org/t/updating-topic-count-in-categories-after-bulk-delete-missing-topics-posts/89355/2 "2018-06-07T14:50:00Z")

</div>

[I had a similar problem](https://meta.discourse.org/t/re-purposing-a-discourse-installation-for-a-yearly-event/34670/17).

The following code (to be run within `rails console`) may solve your problem, make it worse, or set your hair on fire 🔥. Use at your own risk (and with a backup).

```ruby
Category.all.each { |c|
    c.topic_count = c.topics.length - 1 # -1 for about post
    c.save!
}

```

Alternatively, `rake import:ensure_consistency` from [here](https://meta.discourse.org/t/importers-for-large-forums/61681) might help, but it seems to have [destructive side effects](https://meta.discourse.org/t/importers-for-large-forums/61681/49).

---

_[View the full topic](https://meta.discourse.org/t/updating-topic-count-in-categories-after-bulk-delete-missing-topics-posts/89355)._
