Add Status#only_reblogs scope for annual report classes (#35141)
This commit is contained in:
parent
16057f550d
commit
36f01af6c4
5 changed files with 15 additions and 3 deletions
|
|
@ -32,7 +32,7 @@ class AnnualReport::Archetype < AnnualReport::Source
|
|||
end
|
||||
|
||||
def reblogs_count
|
||||
@reblogs_count ||= report_statuses.where.not(reblog_of_id: nil).count
|
||||
@reblogs_count ||= report_statuses.only_reblogs.count
|
||||
end
|
||||
|
||||
def replies_count
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class AnnualReport::MostRebloggedAccounts < AnnualReport::Source
|
|||
private
|
||||
|
||||
def most_reblogged_accounts
|
||||
report_statuses.where.not(reblog_of_id: nil).joins(reblog: :account).group(accounts: [:id]).having(minimum_reblog_count).order(count_all: :desc).limit(SET_SIZE).count
|
||||
report_statuses.only_reblogs.joins(reblog: :account).group(accounts: [:id]).having(minimum_reblog_count).order(count_all: :desc).limit(SET_SIZE).count
|
||||
end
|
||||
|
||||
def minimum_reblog_count
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class AnnualReport::TypeDistribution < AnnualReport::Source
|
|||
{
|
||||
type_distribution: {
|
||||
total: report_statuses.count,
|
||||
reblogs: report_statuses.where.not(reblog_of_id: nil).count,
|
||||
reblogs: report_statuses.only_reblogs.count,
|
||||
replies: report_statuses.where.not(in_reply_to_id: nil).where.not(in_reply_to_account_id: @account.id).count,
|
||||
standalone: report_statuses.without_replies.without_reblogs.count,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue