From 7528273df6a5b30ea152877379353f8a47f247e8 Mon Sep 17 00:00:00 2001 From: Jaymee Hyppolite <54775395+JaymeeH@users.noreply.github.com> Date: Wed, 12 Jun 2024 08:59:44 -0400 Subject: [PATCH] Using quota usage instead of accumulator size on the project contents page (#765) --- app/models/mediaflux/http/asset_metadata_request.rb | 1 + app/models/project.rb | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/mediaflux/http/asset_metadata_request.rb b/app/models/mediaflux/http/asset_metadata_request.rb index 33356d5c..42d91ceb 100644 --- a/app/models/mediaflux/http/asset_metadata_request.rb +++ b/app/models/mediaflux/http/asset_metadata_request.rb @@ -32,6 +32,7 @@ def metadata metadata[:total_file_count] = asset.xpath("./collection/accumulator/value/non-collections").text metadata[:size] = asset.xpath("./collection/accumulator/value/total/@h").text metadata[:quota_allocation] = asset.xpath("./collection/quota/allocation/@h").text + metadata[:quota_used] = asset.xpath("./collection/quota/used/@h").text metadata[:ctime] = asset.xpath("./ctime") end diff --git a/app/models/project.rb b/app/models/project.rb index 7b36cd51..6ea753c2 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -148,12 +148,13 @@ def storage_usage(session_id:) return unless in_mediaflux? values = mediaflux_metadata(session_id:) - value = values.fetch(:size, 0) + #value = values.fetch(:size, 0) + quota_value = values.fetch(:quota_used, '') - if value.blank? + if quota_value.blank? return self.class.default_storage_usage else - return value + return quota_value end end