diff options
-rw-r--r-- | app/models/project_statistics.rb | 3 | ||||
-rw-r--r-- | changelogs/unreleased/26773-fix-project-statistics-repository-size.yml | 4 | ||||
-rw-r--r-- | spec/models/project_statistics_spec.rb | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/app/models/project_statistics.rb b/app/models/project_statistics.rb index 2270ac75071..06abd406523 100644 --- a/app/models/project_statistics.rb +++ b/app/models/project_statistics.rb @@ -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 diff --git a/changelogs/unreleased/26773-fix-project-statistics-repository-size.yml b/changelogs/unreleased/26773-fix-project-statistics-repository-size.yml new file mode 100644 index 00000000000..8ce9bbcb3a9 --- /dev/null +++ b/changelogs/unreleased/26773-fix-project-statistics-repository-size.yml @@ -0,0 +1,4 @@ +--- +title: Adjust ProjectStatistic#repository_size with values saved as MB +merge_request: 8616 +author: diff --git a/spec/models/project_statistics_spec.rb b/spec/models/project_statistics_spec.rb index 77403cc9eb0..ff29f6f66ba 100644 --- a/spec/models/project_statistics_spec.rb +++ b/spec/models/project_statistics_spec.rb @@ -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 |