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

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