mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Isolate date trunc
This commit is contained in:
parent
e2a243ae31
commit
13888d827c
5 changed files with 10 additions and 6 deletions
|
@ -34,10 +34,10 @@ class Admin::Metrics::Measure::InstanceAccountsMeasure < Admin::Metrics::Measure
|
|||
def data_source_query
|
||||
Account
|
||||
.select(:id)
|
||||
.where(account_domain_sql(params[:include_subdomains]))
|
||||
.where(
|
||||
<<~SQL.squish
|
||||
DATE_TRUNC('day', accounts.created_at)::date = axis.period
|
||||
AND #{account_domain_sql(params[:include_subdomains])}
|
||||
SQL
|
||||
).to_sql
|
||||
end
|
||||
|
|
|
@ -35,10 +35,10 @@ class Admin::Metrics::Measure::InstanceFollowersMeasure < Admin::Metrics::Measur
|
|||
Follow
|
||||
.select(:id)
|
||||
.joins(:account)
|
||||
.where(account_domain_sql(params[:include_subdomains]))
|
||||
.where(
|
||||
<<~SQL.squish
|
||||
DATE_TRUNC('day', follows.created_at)::date = axis.period
|
||||
AND #{account_domain_sql(params[:include_subdomains])}
|
||||
SQL
|
||||
).to_sql
|
||||
end
|
||||
|
|
|
@ -35,10 +35,10 @@ class Admin::Metrics::Measure::InstanceFollowsMeasure < Admin::Metrics::Measure:
|
|||
Follow
|
||||
.select(:id)
|
||||
.joins(:target_account)
|
||||
.where(account_domain_sql(params[:include_subdomains]))
|
||||
.where(
|
||||
<<~SQL.squish
|
||||
DATE_TRUNC('day', follows.created_at)::date = axis.period
|
||||
AND #{account_domain_sql(params[:include_subdomains])}
|
||||
SQL
|
||||
).to_sql
|
||||
end
|
||||
|
|
|
@ -35,10 +35,10 @@ class Admin::Metrics::Measure::InstanceReportsMeasure < Admin::Metrics::Measure:
|
|||
Report
|
||||
.select(:id)
|
||||
.joins(:target_account)
|
||||
.where(account_domain_sql(params[:include_subdomains]))
|
||||
.where(
|
||||
<<~SQL.squish
|
||||
DATE_TRUNC('day', reports.created_at)::date = axis.period
|
||||
AND #{account_domain_sql(params[:include_subdomains])}
|
||||
SQL
|
||||
).to_sql
|
||||
end
|
||||
|
|
|
@ -35,11 +35,15 @@ class Admin::Metrics::Measure::InstanceStatusesMeasure < Admin::Metrics::Measure
|
|||
Status
|
||||
.select(:id)
|
||||
.joins(:account)
|
||||
.where(account_domain_sql(params[:include_subdomains]))
|
||||
.where(
|
||||
<<~SQL.squish
|
||||
statuses.id BETWEEN :earliest_status_id AND :latest_status_id
|
||||
AND #{account_domain_sql(params[:include_subdomains])}
|
||||
AND date_trunc('day', statuses.created_at)::date = axis.period
|
||||
SQL
|
||||
)
|
||||
.where(
|
||||
<<~SQL.squish
|
||||
date_trunc('day', statuses.created_at)::date = axis.period
|
||||
SQL
|
||||
).to_sql
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue