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:
parent
950ab1e847
commit
92c25f4200
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue