Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgriffiniii committed Dec 18, 2024
1 parent c2da902 commit 068168e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 8 additions & 6 deletions app/presenters/project_show_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:)
Expand All @@ -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:)
Expand Down
4 changes: 3 additions & 1 deletion spec/system/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 068168e

Please sign in to comment.