From e51d4a05b7195a98b48548c4c7260886f956b6d2 Mon Sep 17 00:00:00 2001
From: Lin Jen-Shin <godfat@godfat.org>
Date: Mon, 18 Jul 2016 21:17:16 +0800
Subject: [PATCH] We should actually give latest success builds as well

---
 app/models/project.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/models/project.rb b/app/models/project.rb
index 1578fe67581..d26aa8073e8 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -432,7 +432,7 @@ class Project < ActiveRecord::Base
   def latest_success_builds_for(ref = 'HEAD')
     Ci::Build.joins(:pipeline).
       merge(pipelines.where(ref: ref).success.latest).
-      with_artifacts
+      with_artifacts.success.latest
   end
 
   def merge_base_commit(first_commit_id, second_commit_id)
-- 
GitLab