From 960acfca72eb9d7d275d5d52323d4934f3787ed0 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 11 Jun 2024 12:08:05 -0400 Subject: [PATCH] media size total --- .../measure/instance_media_attachments_measure.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/lib/admin/metrics/measure/instance_media_attachments_measure.rb b/app/lib/admin/metrics/measure/instance_media_attachments_measure.rb index 8fa5234b429..1e1089f2173 100644 --- a/app/lib/admin/metrics/measure/instance_media_attachments_measure.rb +++ b/app/lib/admin/metrics/measure/instance_media_attachments_measure.rb @@ -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