mirror of
https://github.com/discourse/discourse.git
synced 2025-03-26 00:56:41 +08:00
DEV: Expose user action types where the user was the instigator (#16723)
This commit is contained in:
parent
bc87c1bd5e
commit
cc4171be11
@ -36,6 +36,8 @@ class UserAction < ActiveRecord::Base
|
|||||||
ASSIGNED,
|
ASSIGNED,
|
||||||
].each_with_index.to_a.flatten]
|
].each_with_index.to_a.flatten]
|
||||||
|
|
||||||
|
USER_ACTED_TYPES = [LIKE, NEW_TOPIC, REPLY, NEW_PRIVATE_MESSAGE]
|
||||||
|
|
||||||
def self.types
|
def self.types
|
||||||
@types ||= Enum.new(
|
@types ||= Enum.new(
|
||||||
like: 1,
|
like: 1,
|
||||||
@ -137,7 +139,7 @@ class UserAction < ActiveRecord::Base
|
|||||||
def self.count_daily_engaged_users(start_date = nil, end_date = nil)
|
def self.count_daily_engaged_users(start_date = nil, end_date = nil)
|
||||||
result = select(:user_id)
|
result = select(:user_id)
|
||||||
.distinct
|
.distinct
|
||||||
.where(action_type: [LIKE, NEW_TOPIC, REPLY, NEW_PRIVATE_MESSAGE])
|
.where(action_type: USER_ACTED_TYPES)
|
||||||
|
|
||||||
if start_date && end_date
|
if start_date && end_date
|
||||||
result = result.group('date(created_at)')
|
result = result.group('date(created_at)')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user