Sign-up stats

Continuing the discussion from Why would the number of all time sign-ups ever decrease?:

I imported users from and old forum and they show up in the sign-up stats in About.

I set these users as TL1 and set them to inactive. My undrestanding is that at TL1, they should not be deleted by the automatic clean-up.

I was wondering whether when deactivated, they should still be counted as ‘sign-ups’ and if not, if there is a specific rake command or SQL query to force the re-count?

I think I found the answer:

user_count: User.real.count,
users_last_day: User.real.where('created_at > ?', 1.days.ago).count,
users_7_days: User.real.where('created_at > ?', 7.days.ago).count,
users_30_days: User.real.where('created_at > ?', 30.days.ago).count,
# excluding fake users like the system user or anonymous users
  scope :real,
        ->(allowed_bot_user_ids: nil) do
          human_users(allowed_bot_user_ids: allowed_bot_user_ids).where(
            "NOT EXISTS(
                     SELECT 1
                     FROM anonymous_users a
                     WHERE a.user_id = users.id
                  )",
          )
        end

So deactivated users will still be counted.