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:
parent
b22a152d9d
commit
960acfca72
1 changed files with 7 additions and 5 deletions
|
@ -38,11 +38,7 @@ class Admin::Metrics::Measure::InstanceMediaAttachmentsMeasure < Admin::Metrics:
|
||||||
|
|
||||||
def data_source
|
def data_source
|
||||||
MediaAttachment
|
MediaAttachment
|
||||||
.select(
|
.select(media_size_total)
|
||||||
<<~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))
|
||||||
|
@ -54,6 +50,12 @@ class Admin::Metrics::Measure::InstanceMediaAttachmentsMeasure < Admin::Metrics:
|
||||||
SQL
|
SQL
|
||||||
end
|
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
|
def params
|
||||||
@params.permit(:domain, :include_subdomains)
|
@params.permit(:domain, :include_subdomains)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue