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 20123c2c07
commit e1b4a83f73
11 changed files with 11 additions and 11 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,7 +27,7 @@ class Admin::Metrics::Measure::InstanceStatusesMeasure < Admin::Metrics::Measure
nil
end
def data_source_query
def data_source
Status
.select(:id)
.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 }]
end
def data_source_query
def data_source
User
.select(:id)
.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 }]
end
def data_source_query
def data_source
Report
.select(:id)
.where(daily_period(:reports))

View file

@ -22,7 +22,7 @@ module Admin::Metrics::Measure::QueryHelper
def sql_query_string
<<~SQL.squish
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
) AS value
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
end
def data_source_query
def data_source
Report
.select(:id)
.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')
end
def data_source_query
def data_source
Status
.select('accounts.domain')
.distinct