BigW Consortium Gitlab

Commit 5653a716 by Stan Hu

Merge branch 'rs-repository-size-format' into 'master'

Use `number_to_human_size` helper to show repository size This will intelligently format large repository sizes in GBs (or, shudder, TBs). Also, removes `rescue` clause from `repository_size` helper. The repository size has since become calculated (and cached) more intelligently, and this should no longer be necessary. See merge request !4047
parents 915a4193 54489709
......@@ -200,12 +200,8 @@ module ProjectsHelper
end
def repository_size(project = @project)
"#{project.repository_size} MB"
rescue
# In order to prevent 500 error
# when application cannot allocate memory
# to calculate repo size - just show 'Unknown'
'unknown'
size_in_bytes = project.repository_size * 1.megabyte
number_to_human_size(size_in_bytes, delimiter: ',', precision: 2)
end
def default_url_to_repo(project = @project)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment