Revert change of active user definition
Closes #2560 Active users are needed for selectize, and the active definition changed to show recent users in #2297 This reverts that change, and provides * active scope (user not disabled) * recent scope (for use in #2297 changes, ie user distribution)
This commit is contained in:
parent
cb09d76f51
commit
8cf9c15a46
2 changed files with 7 additions and 4 deletions
|
|
@ -34,7 +34,7 @@ class User < ApplicationRecord
|
|||
scope :comment_notifiable, ->(conference) {joins(:roles).where('roles.name IN (?)', [:organizer, :cfp]).where('roles.resource_type = ? AND roles.resource_id = ?', 'Conference', conference.id)}
|
||||
|
||||
# scopes for user distributions
|
||||
scope :active, lambda {
|
||||
scope :recent, lambda {
|
||||
where('last_sign_in_at > ?', Date.today - 3.months).where(is_disabled: false)
|
||||
}
|
||||
scope :unconfirmed, -> { where('confirmed_at IS NULL') }
|
||||
|
|
@ -86,6 +86,9 @@ class User < ApplicationRecord
|
|||
accepts_nested_attributes_for :roles
|
||||
|
||||
scope :admin, -> { where(is_admin: true) }
|
||||
scope :active, lambda {
|
||||
where(is_disabled: false)
|
||||
}
|
||||
|
||||
validates :email, presence: true
|
||||
|
||||
|
|
@ -174,7 +177,7 @@ class User < ApplicationRecord
|
|||
# * +hash+ -> hash
|
||||
def self.distribution
|
||||
{
|
||||
'Active' => User.active.count,
|
||||
'Active' => User.recent.count,
|
||||
'Unconfirmed' => User.unconfirmed.count,
|
||||
'Dead' => User.dead.count
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue