Commit c699c6fe authored by Alessio Caiazza's avatar Alessio Caiazza Committed by Mayra Cabrera

Fix nil coercion updating storage size on project statistics

parent de4e63b3
...@@ -54,7 +54,7 @@ class ProjectStatistics < ApplicationRecord ...@@ -54,7 +54,7 @@ class ProjectStatistics < ApplicationRecord
end end
def update_storage_size def update_storage_size
self.storage_size = repository_size + wiki_size + lfs_objects_size + build_artifacts_size + packages_size self.storage_size = repository_size + wiki_size.to_i + lfs_objects_size + build_artifacts_size + packages_size
end end
# Since this incremental update method does not call update_storage_size above, # Since this incremental update method does not call update_storage_size above,
......
---
title: Fix nil coercion updating storage size on project statistics
merge_request: 29425
author:
type: fixed
...@@ -197,6 +197,18 @@ describe ProjectStatistics do ...@@ -197,6 +197,18 @@ describe ProjectStatistics do
expect(statistics.storage_size).to eq 9 expect(statistics.storage_size).to eq 9
end end
it 'works during wiki_size backfill' do
statistics.update!(
repository_size: 2,
wiki_size: nil,
lfs_objects_size: 3
)
statistics.reload
expect(statistics.storage_size).to eq 5
end
end end
describe '.increment_statistic' do describe '.increment_statistic' do
......
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