diff --git a/app/lib/admin/metrics/measure/instance_accounts_measure.rb b/app/lib/admin/metrics/measure/instance_accounts_measure.rb index 92f14015c94..079df47df0f 100644 --- a/app/lib/admin/metrics/measure/instance_accounts_measure.rb +++ b/app/lib/admin/metrics/measure/instance_accounts_measure.rb @@ -34,7 +34,7 @@ class Admin::Metrics::Measure::InstanceAccountsMeasure < Admin::Metrics::Measure def data_source_query Account .select(:id) - .where(account_domain_sql(params[:include_subdomains])) + .where(account_domain_sql) .where(daily_period(:accounts)) end diff --git a/app/lib/admin/metrics/measure/instance_followers_measure.rb b/app/lib/admin/metrics/measure/instance_followers_measure.rb index 29e47da1c8b..ddc7a638d68 100644 --- a/app/lib/admin/metrics/measure/instance_followers_measure.rb +++ b/app/lib/admin/metrics/measure/instance_followers_measure.rb @@ -35,7 +35,7 @@ class Admin::Metrics::Measure::InstanceFollowersMeasure < Admin::Metrics::Measur Follow .select(:id) .joins(:account) - .where(account_domain_sql(params[:include_subdomains])) + .where(account_domain_sql) .where(daily_period(:follows)) end diff --git a/app/lib/admin/metrics/measure/instance_follows_measure.rb b/app/lib/admin/metrics/measure/instance_follows_measure.rb index a2d717ccb98..d331d6e7890 100644 --- a/app/lib/admin/metrics/measure/instance_follows_measure.rb +++ b/app/lib/admin/metrics/measure/instance_follows_measure.rb @@ -35,7 +35,7 @@ class Admin::Metrics::Measure::InstanceFollowsMeasure < Admin::Metrics::Measure: Follow .select(:id) .joins(:target_account) - .where(account_domain_sql(params[:include_subdomains])) + .where(account_domain_sql) .where(daily_period(:follows)) end diff --git a/app/lib/admin/metrics/measure/instance_media_attachments_measure.rb b/app/lib/admin/metrics/measure/instance_media_attachments_measure.rb index 7eba483767a..f45238730ae 100644 --- a/app/lib/admin/metrics/measure/instance_media_attachments_measure.rb +++ b/app/lib/admin/metrics/measure/instance_media_attachments_measure.rb @@ -44,7 +44,7 @@ class Admin::Metrics::Measure::InstanceMediaAttachmentsMeasure < Admin::Metrics: MediaAttachment .select('COALESCE(media_attachments.file_file_size, 0) + COALESCE(media_attachments.thumbnail_file_size, 0) AS size') .joins(:account) - .where(account_domain_sql(params[:include_subdomains])) + .where(account_domain_sql) .where(daily_period(:media_attachments)) end diff --git a/app/lib/admin/metrics/measure/instance_reports_measure.rb b/app/lib/admin/metrics/measure/instance_reports_measure.rb index e62dca5937d..bc54a16d871 100644 --- a/app/lib/admin/metrics/measure/instance_reports_measure.rb +++ b/app/lib/admin/metrics/measure/instance_reports_measure.rb @@ -35,7 +35,7 @@ class Admin::Metrics::Measure::InstanceReportsMeasure < Admin::Metrics::Measure: Report .select(:id) .joins(:target_account) - .where(account_domain_sql(params[:include_subdomains])) + .where(account_domain_sql) .where(daily_period(:reports)) end diff --git a/app/lib/admin/metrics/measure/instance_statuses_measure.rb b/app/lib/admin/metrics/measure/instance_statuses_measure.rb index 88c1d9138a8..d22b877aa16 100644 --- a/app/lib/admin/metrics/measure/instance_statuses_measure.rb +++ b/app/lib/admin/metrics/measure/instance_statuses_measure.rb @@ -35,7 +35,7 @@ class Admin::Metrics::Measure::InstanceStatusesMeasure < Admin::Metrics::Measure Status .select(:id) .joins(:account) - .where(account_domain_sql(params[:include_subdomains])) + .where(account_domain_sql) .where( <<~SQL.squish statuses.id BETWEEN :earliest_status_id AND :latest_status_id diff --git a/app/lib/admin/metrics/measure/query_helper.rb b/app/lib/admin/metrics/measure/query_helper.rb index 90e78280ac7..1165bcc0b45 100644 --- a/app/lib/admin/metrics/measure/query_helper.rb +++ b/app/lib/admin/metrics/measure/query_helper.rb @@ -39,8 +39,8 @@ module Admin::Metrics::Measure::QueryHelper SQL end - def account_domain_sql(include_subdomains) - if include_subdomains + def account_domain_sql + if params[:include_subdomains] "accounts.domain IN (SELECT domain FROM instances WHERE reverse('.' || domain) LIKE reverse('.' || :domain::text))" else 'accounts.domain = :domain::text'