Commit 7c7b2041 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '26773-fix-project-statistics-repository-size' into 'master'

Resolve "Wrong file size on repository page"

Closes #26773

See merge request !8616
parents 52e652cb 4bb3675b
...@@ -25,8 +25,9 @@ class ProjectStatistics < ActiveRecord::Base ...@@ -25,8 +25,9 @@ class ProjectStatistics < ActiveRecord::Base
self.commit_count = project.repository.commit_count self.commit_count = project.repository.commit_count
end end
# Repository#size needs to be converted from MB to Byte.
def update_repository_size def update_repository_size
self.repository_size = project.repository.size self.repository_size = project.repository.size * 1.megabyte
end end
def update_lfs_objects_size def update_lfs_objects_size
......
---
title: Adjust ProjectStatistic#repository_size with values saved as MB
merge_request: 8616
author:
...@@ -107,7 +107,7 @@ describe ProjectStatistics, models: true do ...@@ -107,7 +107,7 @@ describe ProjectStatistics, models: true do
describe '#update_repository_size' do describe '#update_repository_size' do
before 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 statistics.update_repository_size
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment