summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-01-18 16:00:57 +0000
committerRémy Coutable <remy@rymai.me>2017-01-18 16:00:57 +0000
commit7c7b20417fa45c54d3fce9aaac2042a8964325d9 (patch)
tree7f614efb5826c9b11cbdb05574bc04e082facf42
parent52e652cbe727f0afc48c74330e6bef72712effad (diff)
parent4bb3675b7d48e5215b63b3e94063188b719c59ea (diff)
downloadgitlab-ce-7c7b20417fa45c54d3fce9aaac2042a8964325d9.tar.gz
Merge branch '26773-fix-project-statistics-repository-size' into 'master'
Resolve "Wrong file size on repository page" Closes #26773 See merge request !8616
-rw-r--r--app/models/project_statistics.rb3
-rw-r--r--changelogs/unreleased/26773-fix-project-statistics-repository-size.yml4
-rw-r--r--spec/models/project_statistics_spec.rb2
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