From 068168ee9f6c7b86bc8fb59100f697a2138026b8 Mon Sep 17 00:00:00 2001 From: jrgriffiniii <1443986+jrgriffiniii@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:22:56 -0500 Subject: [PATCH] wip --- app/presenters/project_show_presenter.rb | 14 ++++++++------ spec/system/project_spec.rb | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/presenters/project_show_presenter.rb b/app/presenters/project_show_presenter.rb index faaae917..0f938bf0 100644 --- a/app/presenters/project_show_presenter.rb +++ b/app/presenters/project_show_presenter.rb @@ -72,20 +72,22 @@ def divisor end end - def default_divisor - 1.0/(1024.0**3) - end - + # Usage is in MB def default_usage_divisor 1.0/(1024.0**1) end + # Capacity is in bytes + def default_capacity_divisor + 1.0/(1024.0**3) + end + # This assumed that the storage usage is recorded in the same units as the units specified in the StorageCapacity metadata def storage_usage(session_id:) persisted = project.storage_usage_raw(session_id: session_id) value = persisted.to_f - cast*default_usage_divisor + value*default_usage_divisor end def formatted_storage_usage(session_id:) @@ -97,7 +99,7 @@ def storage_capacity(session_id:) persisted = project.storage_capacity_raw(session_id: session_id) value = persisted.to_f - cast*default_divisor + value*default_capacity_divisor end def formatted_storage_capacity(session_id:) diff --git a/spec/system/project_spec.rb b/spec/system/project_spec.rb index e7ddbecc..75209cd2 100644 --- a/spec/system/project_spec.rb +++ b/spec/system/project_spec.rb @@ -631,7 +631,9 @@ it "renders the storage capacity in the show view" do visit project_path(approved_project) - expect(page).to have_content "465.661 GB" + expect(page).to have_content "Storage (465.661 GB)" + expect(page).to have_content "0.391 KB Used" + expect(page).to have_content "465.271 GB Free" expect(page).to be_axe_clean .according_to(:wcag2a, :wcag2aa, :wcag21a, :wcag21aa, :section508) .skipping(:'color-contrast')