Adds query for daily engaged users
This commit is contained in:
parent
b6d25f514a
commit
14e700fa50
|
@ -1,4 +1,6 @@
|
|||
class UserAction < ActiveRecord::Base
|
||||
include DateGroupable
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :target_post, class_name: "Post"
|
||||
belongs_to :target_topic, class_name: "Topic"
|
||||
|
@ -119,6 +121,13 @@ SQL
|
|||
|
||||
end
|
||||
|
||||
def self.count_daily_engaged_users(start_date, end_date)
|
||||
select(:user_id).distinct
|
||||
.where(action_type: [LIKE, NEW_TOPIC, REPLY, NEW_PRIVATE_MESSAGE])
|
||||
.smart_group_by_date(:created_at, start_date, end_date)
|
||||
.count
|
||||
end
|
||||
|
||||
def self.stream_item(action_id, guardian)
|
||||
stream(action_id: action_id, guardian: guardian).first
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue