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
end
def extra_sql_params
{ earliest_status_id: earliest_status_id, latest_status_id: latest_status_id }
end
def data_source_query
Status
.select(:id)
.joins(:account)
.where(account_domain_sql, domain: params[:domain])
.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
SQL
)

View file

@ -16,11 +16,7 @@ module Admin::Metrics::Measure::QueryHelper
end
def sql_array
[sql_query_string, { start_at: @start_at, end_at: @end_at }.merge(extra_sql_params)]
end
def extra_sql_params
{}
[sql_query_string, { start_at: @start_at, end_at: @end_at }]
end
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')
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
Status
.select('accounts.domain')
@ -32,7 +28,7 @@ class Admin::Metrics::Measure::TagServersMeasure < Admin::Metrics::Measure::Base
.reorder(nil)
.joins(:tags, :account)
.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
AND statuses.id BETWEEN :earliest_status_id AND :latest_status_id
SQL