From cc4171be118e59a199083a6b81a6e26dffc19a8f Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Wed, 11 May 2022 15:15:53 -0500 Subject: [PATCH] DEV: Expose user action types where the user was the instigator (#16723) --- app/models/user_action.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/user_action.rb b/app/models/user_action.rb index 34872487de..4f13a970a9 100644 --- a/app/models/user_action.rb +++ b/app/models/user_action.rb @@ -36,6 +36,8 @@ class UserAction < ActiveRecord::Base ASSIGNED, ].each_with_index.to_a.flatten] + USER_ACTED_TYPES = [LIKE, NEW_TOPIC, REPLY, NEW_PRIVATE_MESSAGE] + def self.types @types ||= Enum.new( like: 1, @@ -137,7 +139,7 @@ class UserAction < ActiveRecord::Base def self.count_daily_engaged_users(start_date = nil, end_date = nil) result = select(:user_id) .distinct - .where(action_type: [LIKE, NEW_TOPIC, REPLY, NEW_PRIVATE_MESSAGE]) + .where(action_type: USER_ACTED_TYPES) if start_date && end_date result = result.group('date(created_at)')