2024-01-24 09:38:10 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class AnnualReport::CommonlyInteractedWithAccounts < AnnualReport::Source
|
|
|
|
SET_SIZE = 40
|
|
|
|
|
|
|
|
def generate
|
|
|
|
{
|
|
|
|
commonly_interacted_with_accounts: commonly_interacted_with_accounts.map do |(account_id, count)|
|
|
|
|
{
|
2024-10-31 09:38:00 +00:00
|
|
|
account_id: account_id.to_s,
|
2024-01-24 09:38:10 +00:00
|
|
|
count: count,
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def commonly_interacted_with_accounts
|
2024-09-04 19:50:33 +00:00
|
|
|
report_statuses.where.not(in_reply_to_account_id: @account.id).group(:in_reply_to_account_id).having('count(*) > 1').order(total: :desc).limit(SET_SIZE).pluck(Arel.sql('in_reply_to_account_id, count(*) AS total'))
|
2024-01-24 09:38:10 +00:00
|
|
|
end
|
|
|
|
end
|