Fix Project#update_repository_size to convert MB to Bytes properly
This commit is contained in:
parent
65046d9a5e
commit
4bb3675b7d
|
@ -25,8 +25,9 @@ class ProjectStatistics < ActiveRecord::Base
|
|||
self.commit_count = project.repository.commit_count
|
||||
end
|
||||
|
||||
# Repository#size needs to be converted from MB to Byte.
|
||||
def update_repository_size
|
||||
self.repository_size = project.repository.size
|
||||
self.repository_size = project.repository.size * 1.megabyte
|
||||
end
|
||||
|
||||
def update_lfs_objects_size
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Adjust ProjectStatistic#repository_size with values saved as MB
|
||||
merge_request: 8616
|
||||
author:
|
|
@ -107,7 +107,7 @@ describe ProjectStatistics, models: true do
|
|||
|
||||
describe '#update_repository_size' do
|
||||
before do
|
||||
allow(project.repository).to receive(:size).and_return(12.megabytes)
|
||||
allow(project.repository).to receive(:size).and_return(12)
|
||||
statistics.update_repository_size
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue