Automatic Group vs Dashboard


On my Discourse installation, there is a large gap between the number of users in the various trust_level groups in the Groups section and the Users Per Trust Level numbers in the new dashboard. I’m wondering if this is a general bug?

Hi @outofthebox,

Thanks for reaching us about this. I agree it’s kind of ambiguous as the numbers we are showing on the Dashboard are what we call “real users” and is the count of users with this exact “trust_level” on the “users” table.

On the other hand, the groups pages is showing your presence in a group. And basically this is cumulative. Everyone but two users should be in trust_level_0 group even if you are trust_level=4 in “users” table.

Some code to show this:

[22] pry(main)> User.all.count
   (15.9ms)  SELECT COUNT(*) FROM "users"
=> 35956
[23] pry(main)> User.where(trust_level: 0).count
   (17.8ms)  SELECT COUNT(*) FROM "users" WHERE "users"."trust_level" = 0
=> 21028
[24] pry(main)> User.where(trust_level: 1).count
   (18.2ms)  SELECT COUNT(*) FROM "users" WHERE "users"."trust_level" = 1
=> 13180
[25] pry(main)> User.where(trust_level: 2).count
   (17.1ms)  SELECT COUNT(*) FROM "users" WHERE "users"."trust_level" = 2
=> 1685
[26] pry(main)> User.where(trust_level: 3).count
   (16.0ms)  SELECT COUNT(*) FROM "users" WHERE "users"."trust_level" = 3
=> 37
[27] pry(main)> User.where(trust_level: 4).count
   (16.1ms)  SELECT COUNT(*) FROM "users" WHERE "users"."trust_level" = 4
=> 26
[29] pry(main)> 21028+13180+1685+37+26
=> 35956

# 10 is group_id for trust_level_0 group
[30] pry(main)> GroupUser.where(group_id: 10).count
   (22.4ms)  SELECT COUNT(*) FROM "group_users" WHERE "group_users"."group_id" = 10
=> 35954

That makes complete sense! Thanks for the insightful clarification!