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

media size total

This commit is contained in:
Matt Jankowski 2024-06-11 12:08:05 -04:00
parent b22a152d9d
commit 960acfca72

View file

@ -38,11 +38,7 @@ class Admin::Metrics::Measure::InstanceMediaAttachmentsMeasure < Admin::Metrics:
def data_source
MediaAttachment
.select(
<<~SQL.squish
COALESCE(media_attachments.file_file_size, 0) + COALESCE(media_attachments.thumbnail_file_size, 0) AS size
SQL
)
.select(media_size_total)
.joins(:account)
.where(account_domain_sql, domain: params[:domain])
.where(daily_period(:media_attachments))
@ -54,6 +50,12 @@ class Admin::Metrics::Measure::InstanceMediaAttachmentsMeasure < Admin::Metrics:
SQL
end
def media_size_total
<<~SQL.squish
COALESCE(media_attachments.file_file_size, 0) + COALESCE(media_attachments.thumbnail_file_size, 0) AS size
SQL
end
def params
@params.permit(:domain, :include_subdomains)
end