Use `number_to_human_size` helper to show repository size

This will intelligently format large repository sizes in GBs (or,
shudder, TBs).
This commit is contained in:
Robert Speicher 2016-05-04 17:33:58 -04:00
parent 950ab1e847
commit 92c25f4200
1 changed files with 2 additions and 1 deletions

View File

@ -200,7 +200,8 @@ module ProjectsHelper
end
def repository_size(project = @project)
"#{project.repository_size} MB"
size_in_bytes = project.repository_size * 1.megabyte
number_to_human_size(size_in_bytes, delimiter: ',', precision: 2)
rescue
# In order to prevent 500 error
# when application cannot allocate memory