1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Embroil it in controversery

This commit is contained in:
Matt Jankowski 2024-06-11 11:44:11 -04:00
parent f87bbe6184
commit 84411d4c97
3 changed files with 8 additions and 10 deletions

View file

@ -32,11 +32,7 @@ class Admin::Metrics::Measure::InstanceStatusesMeasure < Admin::Metrics::Measure
.select(:id) .select(:id)
.joins(:account) .joins(:account)
.where(account_domain_sql, domain: params[:domain]) .where(account_domain_sql, domain: params[:domain])
.where( .where(status_range_sql, earliest_status_id: earliest_status_id, latest_status_id: latest_status_id)
<<~SQL.squish, earliest_status_id: earliest_status_id, latest_status_id: latest_status_id
statuses.id BETWEEN :earliest_status_id AND :latest_status_id
SQL
)
.where(daily_period(:statuses)) .where(daily_period(:statuses))
end end

View file

@ -43,6 +43,12 @@ module Admin::Metrics::Measure::QueryHelper
SQL SQL
end end
def status_range_sql
<<~SQL.squish
statuses.id BETWEEN :earliest_status_id AND :latest_status_id
SQL
end
def account_domain_sql def account_domain_sql
if params[:include_subdomains] if params[:include_subdomains]
<<~SQL.squish <<~SQL.squish

View file

@ -28,11 +28,7 @@ class Admin::Metrics::Measure::TagServersMeasure < Admin::Metrics::Measure::Base
.reorder(nil) .reorder(nil)
.joins(:tags, :account) .joins(:tags, :account)
.where(statuses_tags: { tag_id: tag.id }) .where(statuses_tags: { tag_id: tag.id })
.where( .where(status_range_sql, earliest_status_id: earliest_status_id, latest_status_id: latest_status_id)
<<~SQL.squish, earliest_status_id: earliest_status_id, latest_status_id: latest_status_id
statuses.id BETWEEN :earliest_status_id AND :latest_status_id
SQL
)
.where(daily_period(:statuses)) .where(daily_period(:statuses))
end end