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

wrap with sql

This commit is contained in:
Matt Jankowski 2024-06-11 11:37:24 -04:00
parent 324e9673cb
commit abe946296b

View file

@ -38,7 +38,11 @@ class Admin::Metrics::Measure::InstanceMediaAttachmentsMeasure < Admin::Metrics:
def data_source_query def data_source_query
MediaAttachment MediaAttachment
.select('COALESCE(media_attachments.file_file_size, 0) + COALESCE(media_attachments.thumbnail_file_size, 0) AS size') .select(
<<~SQL.squish
COALESCE(media_attachments.file_file_size, 0) + COALESCE(media_attachments.thumbnail_file_size, 0) AS size
SQL
)
.joins(:account) .joins(:account)
.where(account_domain_sql, domain: params[:domain]) .where(account_domain_sql, domain: params[:domain])
.where(daily_period(:media_attachments)) .where(daily_period(:media_attachments))