added some methods to make it easier to figure out how many active users a pod has
This commit is contained in:
parent
f1c119452a
commit
7a565b051d
1 changed files with 16 additions and 0 deletions
|
|
@ -82,6 +82,22 @@ class User < ActiveRecord::Base
|
||||||
User.joins(:contacts).where(:contacts => {:person_id => person.id})
|
User.joins(:contacts).where(:contacts => {:person_id => person.id})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.monthly_actives(start_day = Time.now)
|
||||||
|
logged_in_since(start_day - 1.month)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.yearly_actives(start_day = Time.now)
|
||||||
|
logged_in_since(start_day - 1.year)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.daily_actives(start_day = Time.now)
|
||||||
|
logged_in_since(start_day - 1.day)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.logged_in_since(time)
|
||||||
|
where('last_sign_in_at > ?', time)
|
||||||
|
end
|
||||||
|
|
||||||
# @return [User]
|
# @return [User]
|
||||||
def self.find_by_invitation(invitation)
|
def self.find_by_invitation(invitation)
|
||||||
service = invitation.service
|
service = invitation.service
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue