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

Remove extra sql args

This commit is contained in:
Matt Jankowski 2024-06-11 11:34:16 -04:00
parent e0692262d1
commit 324e9673cb
3 changed files with 3 additions and 15 deletions

View file

@ -27,17 +27,13 @@ class Admin::Metrics::Measure::InstanceStatusesMeasure < Admin::Metrics::Measure
nil nil
end end
def extra_sql_params
{ earliest_status_id: earliest_status_id, latest_status_id: latest_status_id }
end
def data_source_query def data_source_query
Status Status
.select(:id) .select(:id)
.joins(:account) .joins(:account)
.where(account_domain_sql, domain: params[:domain]) .where(account_domain_sql, domain: params[:domain])
.where( .where(
<<~SQL.squish <<~SQL.squish, earliest_status_id: earliest_status_id, latest_status_id: latest_status_id
statuses.id BETWEEN :earliest_status_id AND :latest_status_id statuses.id BETWEEN :earliest_status_id AND :latest_status_id
SQL SQL
) )

View file

@ -16,11 +16,7 @@ module Admin::Metrics::Measure::QueryHelper
end end
def sql_array def sql_array
[sql_query_string, { start_at: @start_at, end_at: @end_at }.merge(extra_sql_params)] [sql_query_string, { start_at: @start_at, end_at: @end_at }]
end
def extra_sql_params
{}
end end
def sql_query_string def sql_query_string

View file

@ -21,10 +21,6 @@ class Admin::Metrics::Measure::TagServersMeasure < Admin::Metrics::Measure::Base
tag.statuses.where('statuses.id BETWEEN ? AND ?', Mastodon::Snowflake.id_at(@start_at - length_of_period, with_random: false), Mastodon::Snowflake.id_at(@end_at - length_of_period, with_random: false)).joins(:account).count('distinct accounts.domain') tag.statuses.where('statuses.id BETWEEN ? AND ?', Mastodon::Snowflake.id_at(@start_at - length_of_period, with_random: false), Mastodon::Snowflake.id_at(@end_at - length_of_period, with_random: false)).joins(:account).count('distinct accounts.domain')
end end
def extra_sql_params
{ tag_id: tag.id, earliest_status_id: earliest_status_id, latest_status_id: latest_status_id }
end
def data_source_query def data_source_query
Status Status
.select('accounts.domain') .select('accounts.domain')
@ -32,7 +28,7 @@ class Admin::Metrics::Measure::TagServersMeasure < Admin::Metrics::Measure::Base
.reorder(nil) .reorder(nil)
.joins(:tags, :account) .joins(:tags, :account)
.where( .where(
<<~SQL.squish <<~SQL.squish, tag_id: tag.id, earliest_status_id: earliest_status_id, latest_status_id: latest_status_id
statuses_tags.tag_id = :tag_id statuses_tags.tag_id = :tag_id
AND statuses.id BETWEEN :earliest_status_id AND :latest_status_id AND statuses.id BETWEEN :earliest_status_id AND :latest_status_id
SQL SQL