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

Rename to data_source

This commit is contained in:
Matt Jankowski 2024-06-11 12:02:50 -04:00
parent 84411d4c97
commit b22a152d9d
11 changed files with 11 additions and 11 deletions

View file

@ -27,7 +27,7 @@ class Admin::Metrics::Measure::InstanceAccountsMeasure < Admin::Metrics::Measure
nil nil
end end
def data_source_query def data_source
Account Account
.select(:id) .select(:id)
.where(account_domain_sql, domain: params[:domain]) .where(account_domain_sql, domain: params[:domain])

View file

@ -27,7 +27,7 @@ class Admin::Metrics::Measure::InstanceFollowersMeasure < Admin::Metrics::Measur
nil nil
end end
def data_source_query def data_source
Follow Follow
.select(:id) .select(:id)
.joins(:account) .joins(:account)

View file

@ -27,7 +27,7 @@ class Admin::Metrics::Measure::InstanceFollowsMeasure < Admin::Metrics::Measure:
nil nil
end end
def data_source_query def data_source
Follow Follow
.select(:id) .select(:id)
.joins(:target_account) .joins(:target_account)

View file

@ -36,7 +36,7 @@ class Admin::Metrics::Measure::InstanceMediaAttachmentsMeasure < Admin::Metrics:
nil nil
end end
def data_source_query def data_source
MediaAttachment MediaAttachment
.select( .select(
<<~SQL.squish <<~SQL.squish

View file

@ -27,7 +27,7 @@ class Admin::Metrics::Measure::InstanceReportsMeasure < Admin::Metrics::Measure:
nil nil
end end
def data_source_query def data_source
Report Report
.select(:id) .select(:id)
.joins(:target_account) .joins(:target_account)

View file

@ -27,7 +27,7 @@ class Admin::Metrics::Measure::InstanceStatusesMeasure < Admin::Metrics::Measure
nil nil
end end
def data_source_query def data_source
Status Status
.select(:id) .select(:id)
.joins(:account) .joins(:account)

View file

@ -21,7 +21,7 @@ class Admin::Metrics::Measure::NewUsersMeasure < Admin::Metrics::Measure::BaseMe
[sql_query_string, { start_at: @start_at, end_at: @end_at }] [sql_query_string, { start_at: @start_at, end_at: @end_at }]
end end
def data_source_query def data_source
User User
.select(:id) .select(:id)
.where(daily_period(:users)) .where(daily_period(:users))

View file

@ -21,7 +21,7 @@ class Admin::Metrics::Measure::OpenedReportsMeasure < Admin::Metrics::Measure::B
[sql_query_string, { start_at: @start_at, end_at: @end_at }] [sql_query_string, { start_at: @start_at, end_at: @end_at }]
end end
def data_source_query def data_source
Report Report
.select(:id) .select(:id)
.where(daily_period(:reports)) .where(daily_period(:reports))

View file

@ -22,7 +22,7 @@ module Admin::Metrics::Measure::QueryHelper
def sql_query_string def sql_query_string
<<~SQL.squish <<~SQL.squish
SELECT axis.*, ( SELECT axis.*, (
WITH data_source AS (#{data_source_query.to_sql}) WITH data_source AS (#{data_source.to_sql})
SELECT #{select_target} FROM data_source SELECT #{select_target} FROM data_source
) AS value ) AS value
FROM ( FROM (

View file

@ -17,7 +17,7 @@ class Admin::Metrics::Measure::ResolvedReportsMeasure < Admin::Metrics::Measure:
Report.resolved.where(action_taken_at: previous_time_period).count Report.resolved.where(action_taken_at: previous_time_period).count
end end
def data_source_query def data_source
Report Report
.select(:id) .select(:id)
.where(daily_period(:reports, :action_taken_at)) .where(daily_period(:reports, :action_taken_at))

View file

@ -21,7 +21,7 @@ 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 data_source_query def data_source
Status Status
.select('accounts.domain') .select('accounts.domain')
.distinct .distinct