From 324e9673cbd5df2bed47ff9725f65120a0a803dd Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 11 Jun 2024 11:34:16 -0400 Subject: [PATCH] Remove extra sql args --- app/lib/admin/metrics/measure/instance_statuses_measure.rb | 6 +----- app/lib/admin/metrics/measure/query_helper.rb | 6 +----- app/lib/admin/metrics/measure/tag_servers_measure.rb | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/app/lib/admin/metrics/measure/instance_statuses_measure.rb b/app/lib/admin/metrics/measure/instance_statuses_measure.rb index 2c0c3769d3e..b574b19c4d4 100644 --- a/app/lib/admin/metrics/measure/instance_statuses_measure.rb +++ b/app/lib/admin/metrics/measure/instance_statuses_measure.rb @@ -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 ) diff --git a/app/lib/admin/metrics/measure/query_helper.rb b/app/lib/admin/metrics/measure/query_helper.rb index 83d0a6fc16b..7c019ed2638 100644 --- a/app/lib/admin/metrics/measure/query_helper.rb +++ b/app/lib/admin/metrics/measure/query_helper.rb @@ -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 diff --git a/app/lib/admin/metrics/measure/tag_servers_measure.rb b/app/lib/admin/metrics/measure/tag_servers_measure.rb index 1789c6c42fa..a76c67c7e35 100644 --- a/app/lib/admin/metrics/measure/tag_servers_measure.rb +++ b/app/lib/admin/metrics/measure/tag_servers_measure.rb @@ -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