|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
class AnnualReport::CommonlyInteractedWithAccounts < AnnualReport::Source
|
|
|
|
|
MINIMUM_INTERACTIONS = 1
|
|
|
|
|
SET_SIZE = 40
|
|
|
|
|
|
|
|
|
|
def generate
|
|
|
|
@ -17,6 +18,10 @@ class AnnualReport::CommonlyInteractedWithAccounts < AnnualReport::Source
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def commonly_interacted_with_accounts
|
|
|
|
|
report_statuses.where.not(in_reply_to_account_id: @account.id).group(:in_reply_to_account_id).having('count(*) > 1').order(count_all: :desc).limit(SET_SIZE).count
|
|
|
|
|
report_statuses.where.not(in_reply_to_account_id: @account.id).group(:in_reply_to_account_id).having(minimum_interaction_count).order(count_all: :desc).limit(SET_SIZE).count
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def minimum_interaction_count
|
|
|
|
|
Arel.star.count.gt(MINIMUM_INTERACTIONS)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|