Commit 22aef3d4 authored by Nick Thomas's avatar Nick Thomas

Fix a bug calculating artifact size for project statistics

parent 7b0872c7
......@@ -37,7 +37,7 @@ class ProjectStatistics < ActiveRecord::Base
def update_build_artifacts_size
self.build_artifacts_size =
project.builds.sum(:artifacts_size) +
Ci::JobArtifact.artifacts_size_for(self)
Ci::JobArtifact.artifacts_size_for(self.project)
end
def update_storage_size
......
---
title: Fix a bug calculating artifact size for project statistics
merge_request: 16539
author:
type: fixed
......@@ -146,6 +146,12 @@ describe ProjectStatistics do
expect(statistics.build_artifacts_size).to be(106365)
end
it 'calculates related build artifacts by project' do
expect(Ci::JobArtifact).to receive(:artifacts_size_for).with(project) { 0 }
statistics.update_build_artifacts_size
end
end
context 'when legacy artifacts are used' 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