summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-06-26 13:03:30 +0000
committerValery Sizov <valery@gitlab.com>2015-06-26 13:03:30 +0000
commitc4657e482bfe68b59235214220a9aa294b16d104 (patch)
treeff70acb9732acf762d0a4974efd24c5354b1351e /app
parent07383304a5d0593875025c3317e1914efe74b7f6 (diff)
parent744d291de7f7387564900c77999d6d6b712e1837 (diff)
downloadgitlab-ci-c4657e482bfe68b59235214220a9aa294b16d104.tar.gz
Merge branch 'coverage_fix' into 'master'
Fix coverage colcalation on the commit page See merge request !171
Diffstat (limited to 'app')
-rw-r--r--app/models/commit.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 215afdd..7cf2810 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -205,8 +205,11 @@ class Commit < ActiveRecord::Base
end
def coverage
- if project.coverage_enabled? && builds.size > 0
- builds.last.coverage
+ if project.coverage_enabled? && builds.count(:all) > 0
+ coverage_array = builds.map(&:coverage).compact
+ if coverage_array.size > 1
+ coverage_array.reduce(:+) / coverage_array.size
+ end
end
end