FIX: participating users statistics... (#29293)

* FIX: participating users statistics...

... was (mis-)counting

- bots
- anonymous users
- suspended users

There's now a "valid_users" function that holds the AR query for valid users and which is used in all "users", "active_users", and "participating_users" queries.

Internal ref - t/138435
This commit is contained in:
Régis Hanol
2024-10-21 18:18:42 +02:00
committed by GitHub
parent 481d0645a9
commit 88449541a5
3 changed files with 50 additions and 27 deletions

View File

@ -303,6 +303,7 @@ class User < ActiveRecord::Base
scope :not_suspended, -> { where("suspended_till IS NULL OR suspended_till <= ?", Time.zone.now) }
scope :activated, -> { where(active: true) }
scope :not_staged, -> { where(staged: false) }
scope :approved, -> { where(approved: true) }
scope :filter_by_username,
->(filter) do